keys.toArray(headers);
writer.writeHeader(headers);
writer.write(map, headers);
}
else if (object != null) {
ICsvBeanWriter writer = new CsvBeanWriter(out, preference);
PropertyDescriptor[] properties = BeanUtils.getPropertyDescriptors(object.getClass());
int size = properties.length;
String[] headers = new String[size];
for (int i = 0; i < size; i++) {
headers[i] = properties[i].getName();
}
writer.writeHeader(headers);
writer.write(object, headers);
}
out.close();
}