Skip to content

vbsw/csvio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSV IO

About

CSV IO is a library to read and write CSV files. CSV IO is published on https://github.com/vbsw/csvio and https://gitlab.com/vbsw/csvio.

Example

Code:

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;

public class Main {

	public static void main ( String[] args ) throws Exception {
		final Path path = Paths.get(System.getProperty("user.home"),"csvio.test.csv");
		final String content = "asdf,qwer,yxcv \n a,b,c,d";
		final CSVFile file = new CSVFile(path);
		Files.write(path,content.getBytes());

		final CSVFileReader reader = file.getReader();
		for (String[] fields: reader) {
			System.out.println(Arrays.toString(fields));
		}
		reader.close();
		System.out.println("bytes read: " + reader.getStats().bytesCount);

		Files.delete(path);
	}

}

Output:

[asdf, qwer, yxcv]
[a, b, c, d]
bytes read: 24

Compiling

Install Java, Git and Eclipse.

Clone this project into your Eclipse workspace

$ git clone https://github.com/vbsw/csvio.git

Open Eclipse and create a Java Project named csvio (like previously created directory). To create a jar file, right click on project, then "export...", then export as "JAR file".

References