public class CsvFoolReader
extends java.lang.Object
A simple reader for CSV files. It can handle files with comments (starting with "#") and split on the basis of different characters (default: ",").
The most natural return format is a 2-dimensions arrays of Strings. Still it is also possible to get a List of 1-dimension arrays of Strings. If the CSV is not "squared"; i.e. the number of fields is different across rows, the method might not work properly.
Constructor and Description |
---|
CsvFoolReader() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[][] |
csv2matrix(java.io.File file)
Reads a csv file and return a 2-dimensional array of Strings of
it.
|
static java.lang.String[][] |
csv2matrix(java.io.File file,
java.lang.String separator)
Reads a csv file.
|
static java.util.List<java.lang.String[]> |
csvFileToList(java.io.File file) |
static java.util.List<java.lang.String[]> |
csvFileToList(java.io.File file,
java.lang.String separator) |
public static java.lang.String[][] csv2matrix(java.io.File file)
file
- public static java.lang.String[][] csv2matrix(java.io.File file, java.lang.String separator)
file
- separator
- character(s) that separate the fieldspublic static java.util.List<java.lang.String[]> csvFileToList(java.io.File file)
public static java.util.List<java.lang.String[]> csvFileToList(java.io.File file, java.lang.String separator)