-
Notifications
You must be signed in to change notification settings - Fork 76
CsvWriter
Arnaud Roger edited this page Jul 2, 2015
·
2 revisions
// if you will reuse the same writer it is better to cache the dsl object
CsvWriter.CsvWriterDSL<DbObject> dsl = CsvWriter.from(DbObject.class);
try (FileWriter writer = new FileWriter("test.csv")) {
CsvWriter<DbObject> csvWriter = dsl.to(writer);
csvWriter.append(obj1);
}
CsvWriter.CsvWriterDSL<DbObject> dsl =
CsvWriter
.from(DbObject.class)
.columns("id", "name", "email");
try (FileWriter writer = new FileWriter("test.csv")) {
CsvWriter<DbObject> csvWriter = dsl.to(writer);
csvWriter.append(obj1);
}
CsvWriter.CsvWriterDSL<DbObject> dsl =
CsvWriter
.from(DbObject.class)
.columns("id", "name", "email")
.column("creation_time", new SimpleDateFormat("dd/MM/yyyy"));
try (FileWriter writer = new FileWriter("test.csv")) {
CsvWriter<DbObject> csvWriter = dsl.to(writer);
csvWriter.append(obj1);
}