根据这篇关于SuperCSV 能力的帖子,SuperCSV可以处理更改从数据库读取的标题(仅限列名)的值吗?
例如,以下代码片段详细说明了当前状态和预期状态。
当前状态
输入:
final String[] header = new String[] { "firstName", "lastName", "birthDate"};
// write the header
beanWriter.writeHeader(header);
// write the beans
for( final CustomerBean customer : customers ) {
beanWriter.write(customer, header, processors);
}
输出:具有列名的文件:
firstName, lastName, birthDate
Bob , Doe , 02/12/2013
预期状态
输入:
final String[] header = new String[] { "firstName", "lastName", "birthDate"};
// write the header
beanWriter.writeHeader(header);
// write the beans
for( final CustomerBean customer : customers ) {
beanWriter.write(customer, header, processors);
}
// modify the headers
??????
OUTPUT:具有修改列名的文件:
First Name, Last Name, Birthday
Bob , Doe , 02/12/2013
非常感谢任何帮助。