public class CSVHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LINE_END |
static char |
DEFAULT_SEPARATOR |
protected String |
lineEnd |
protected char |
separator |
Constructor and Description |
---|
CSVHelper() |
CSVHelper(char separator) |
CSVHelper(char separator,
String lineEnd) |
Modifier and Type | Method and Description |
---|---|
void |
close(Reader aReader)
Close the file reader
|
void |
close(Writer aWriter)
Close the file writer
|
void |
flush(Writer aWriter)
Write any data in buffer to file writer
|
protected String[] |
parseLine(String nextLine)
Tokenize the string by Separator ","
|
List<String[]> |
readAll(File aFilename)
Read the content from file and convert to list of string array
|
void |
writeNext(File filename,
String[] aNextLine)
Write the string array to file.
|
public static final char DEFAULT_SEPARATOR
public static final String DEFAULT_LINE_END
protected char separator
protected String lineEnd
public CSVHelper()
public CSVHelper(char separator)
public CSVHelper(char separator, String lineEnd)
public void writeNext(File filename, String[] aNextLine) throws IOException, SecurityException
filename
- aNextLine
- IOException
SecurityException
public List<String[]> readAll(File aFilename) throws IOException
aFilename
- IOException
protected String[] parseLine(String nextLine)
nextLine
- public void flush(Writer aWriter) throws IOException
aWriter
- IOException
public void close(Writer aWriter) throws IOException
aWriter
- IOException
public void close(Reader aReader) throws IOException
aReader
- IOException