public class Csv extends Object
| Constructor and Description |
|---|
Csv() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close all streams.
|
char |
getEscapeCharacter()
Get the current escape character.
|
char |
getFieldDelimiter()
Get the current field delimiter.
|
char |
getFieldSeparatorRead()
Get the current field separator for reading.
|
String |
getFieldSeparatorWrite()
Get the current field separator for writing.
|
String |
getNullString()
Get the current null string.
|
String |
getRowSeparatorWrite()
Get the current row separator for writing.
|
Iterator<String[]> |
read(InputStream in,
String charset)
Reads from the CSV file and returns an iterator.
|
Iterator<String[]> |
read(Reader reader)
Reads from the CSV file and returns an iterator.
|
void |
setEscapeCharacter(char escapeCharacter)
Set the escape character (used to escape the field delimiter).
|
void |
setFieldDelimiter(char fieldDelimiter)
Set the field delimiter.
|
void |
setFieldSeparatorRead(char fieldSeparatorRead)
Override the field separator for reading.
|
void |
setFieldSeparatorWrite(String fieldSeparatorWrite)
Override the field separator for writing.
|
void |
setLineSeparator(String lineSeparator)
Set the line separator.
|
void |
setNullString(String nullString)
Set the value that represents NULL.
|
void |
setRowSeparatorWrite(String rowSeparatorWrite)
Override the end-of-row marker for writing.
|
void |
writeInit(OutputStream out,
String charset)
Initialize writing.
|
void |
writeInit(Writer writer)
Initialize writing.
|
void |
writeRow(String... values)
Write a row.
|
public Iterator<String[]> read(InputStream in, String charset) throws IOException
in - the input streamcharset - the charset or null to use the system default charset (see
system property file.encoding)IOExceptionpublic Iterator<String[]> read(Reader reader) throws IOException
reader - the readerIOExceptionpublic void writeInit(OutputStream out, String charset) throws IOException
out - the output streamcharset - the character set or nullIOExceptionpublic void writeInit(Writer writer) throws IOException
writer - the writerIOExceptionpublic void writeRow(String... values) throws IOException
values - the valuesIOExceptionpublic void close()
throws IOException
IOExceptionpublic void setFieldSeparatorWrite(String fieldSeparatorWrite)
fieldSeparatorWrite - the field separatorpublic String getFieldSeparatorWrite()
public void setFieldSeparatorRead(char fieldSeparatorRead)
fieldSeparatorRead - the field separatorpublic char getFieldSeparatorRead()
public String getRowSeparatorWrite()
public void setRowSeparatorWrite(String rowSeparatorWrite)
rowSeparatorWrite - the row separatorpublic void setFieldDelimiter(char fieldDelimiter)
fieldDelimiter - the field delimiterpublic char getFieldDelimiter()
public void setEscapeCharacter(char escapeCharacter)
escapeCharacter - the escape characterpublic char getEscapeCharacter()
public void setLineSeparator(String lineSeparator)
lineSeparator - the line separatorpublic void setNullString(String nullString)
nullString - the nullpublic String getNullString()
Copyright © 2010 - 2020 Adobe. All Rights Reserved