| Constructor and Description |
|---|
CSVReader(Reader aReader)
Constructs CSVReader using a comma for the separator.
|
CSVReader(Reader aReader,
boolean bKeepCR)
Constructs
CSVReader using a comma for the separator. |
CSVReader(Reader aReader,
CSVParser aParser,
boolean bKeepCR)
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying reader.
|
char |
getEscapeChar() |
CSVParser |
getParser() |
char |
getQuoteChar() |
char |
getSeparatorChar() |
int |
getSkipLines()
Returns the number of lines in the csv file to skip before processing.
|
boolean |
isIgnoreLeadingWhiteSpace() |
boolean |
isIgnoreQuotations() |
boolean |
isKeepCarriageReturns()
Returns if the reader will keep carriage returns found in data or remove
them.
|
boolean |
isStrictQuotes() |
boolean |
isVerifyReader()
Returns if the CSVReader will verify the reader before each read.
|
Iterator<List<String>> |
iterator()
Creates an Iterator for processing the csv data.
|
List<List<String>> |
readAll()
Reads the entire file into a List with each element being a List of
String of tokens. |
List<String> |
readNext()
Reads the next line from the buffer and converts to a string array.
|
CSVReader |
setEscapeChar(char cEscapeChar)
Sets the character to use for escaping a separator or quote.
|
CSVReader |
setIgnoreLeadingWhiteSpace(boolean bIgnoreLeadingWhiteSpace)
Sets the ignore leading whitespace setting - if true, white space in front
of a quote in a field is ignored.
|
CSVReader |
setIgnoreQuotations(boolean bIgnoreQuotations)
Sets the ignore quotations mode - if
true, quotations are
ignored. |
CSVReader |
setQuoteChar(char cQuoteChar)
Sets the character to use for quoted elements.
|
CSVReader |
setSeparatorChar(char cSeparator)
Sets the delimiter to use for separating entries.
|
CSVReader |
setSkipLines(int nSkipLines)
Sets the line number to skip for start reading.
|
CSVReader |
setStrictQuotes(boolean bStrictQuotes)
Sets the strict quotes setting - if true, characters outside the quotes are
ignored.
|
CSVReader |
setVerifyReader(boolean bVerifyReader)
Checks to see if the CSVReader should verify the reader state before reads
or not.
|
public CSVReader(@Nonnull Reader aReader)
aReader - the reader to an underlying CSV source.public CSVReader(@Nonnull Reader aReader, boolean bKeepCR)
CSVReader using a comma for the separator.aReader - the reader to an underlying CSV source.bKeepCR - true to keep carriage returns in data read,
false otherwisepublic char getSeparatorChar()
@Nonnull public CSVReader setSeparatorChar(char cSeparator)
cSeparator - the delimiter to use for separating entriespublic char getQuoteChar()
@Nonnull public CSVReader setQuoteChar(char cQuoteChar)
cQuoteChar - the character to use for quoted element.public char getEscapeChar()
@Nonnull public CSVReader setEscapeChar(char cEscapeChar)
cEscapeChar - the character to use for escaping a separator or quote.public boolean isStrictQuotes()
@Nonnull public CSVReader setStrictQuotes(boolean bStrictQuotes)
bStrictQuotes - if true, characters outside the quotes are ignoredpublic boolean isIgnoreLeadingWhiteSpace()
@Nonnull public CSVReader setIgnoreLeadingWhiteSpace(boolean bIgnoreLeadingWhiteSpace)
bIgnoreLeadingWhiteSpace - if true, white space in front of a quote in a field is
ignoredpublic boolean isIgnoreQuotations()
@Nonnull public CSVReader setIgnoreQuotations(boolean bIgnoreQuotations)
true, quotations are
ignored.bIgnoreQuotations - if true, quotations are ignored@Nonnegative public int getSkipLines()
@Nonnull public CSVReader setSkipLines(@Nonnegative int nSkipLines)
nSkipLines - the line number to skip for start reading.public boolean isKeepCarriageReturns()
public boolean isVerifyReader()
true if CSVReader will verify the reader before reads.
false otherwise.@Nonnull public CSVReader setVerifyReader(boolean bVerifyReader)
bVerifyReader - true if CSVReader should verify reader before each
read, false otherwise.@Nonnull @ReturnsMutableCopy public List<List<String>> readAll() throws IOException
String of tokens.String
representing a line of the file.IOException - if bad things happen during the read@Nullable public List<String> readNext() throws IOException
IOException - if bad things happen during the readpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if the close failsCopyright © 2014–2015 Philip Helger. All rights reserved.