|
UsersGuide
User's guide.
jCSVlib User's GuideFor more information, please refer to the project's Javadoc. Basic UsageCreating a CSV instanceCsv csv = CsvFactory.createOfficeCsv(); Data structure manipulationcsv.add(0, 0, "mydata"); csv.add(1, 1, "anotherdata"); String content = csv.get(1, 1); // content = "anotherdata" csv.remove(1, 1); int i = csv.getColumns(); // i = 1 int j = csv.getRows(); // j = 1 Iterating over the structureString content;
for (int i = 0; i < csv.getRows(); i++) {
for (int j = 0; j < csv.getColumns(); j++) {
content = csv.get(i, j);
System.out.println(content);
}
}Reading a CSV file from diskCsv csv = CsvFactory.createOfficeCsv();
InputStream is = new FileInputStream("SimpleCsv.csv");
csv.load(is);Writing a CSV file to diskCsv csv = CsvFactory.createOfficeCsv();
OutputStream os = new FileOutputStream("MyCsv.csv");
csv.store(os);Advanced FeaturesCreating a thread-safe CSV implementationCsv csv = CsvFactory.createOfficeCsv(); Csv syncCsv = CsvFactory.synchronizedCsv(csv); Customizing CSV delimiters// Using single quote as text delimiter and semi-colon as field separator
Csv customCsv = new BasicCsv(new CustomDelimitersCsvParser("'", ";"));
|
Sign in to add a comment