java.lang.Object
org.jooq.tools.csv.CSVReader
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Iterator<String[]>
A very simple CSV reader released under a commercial-friendly license.
- Author:
- Glen Smith
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe default line to start reading.
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs CSVReader using a comma for the separator.Constructs CSVReader with supplied separator.Constructs CSVReader with supplied separator and quote char.Constructs CSVReader with supplied separator, quote char and quote handling behavior.Constructs CSVReader with supplied separator and quote char.Constructs CSVReader with supplied separator and quote char.CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes) Constructs CSVReader with supplied separator and quote char.CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) Constructs CSVReader with supplied separator and quote char.Constructs CSVReader with supplied separator and quote char.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes the underlying reader.booleanhasNext()String[]next()readAll()Reads the entire file into a List with each element being a String[] of tokens.String[]readNext()Reads the next line from the buffer and converts to a string array.voidremove()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Field Details- 
DEFAULT_SKIP_LINESpublic static final int DEFAULT_SKIP_LINESThe default line to start reading.- See Also:
 
 
- 
- 
Constructor Details- 
CSVReaderConstructs CSVReader using a comma for the separator.- Parameters:
- reader- the reader to an underlying CSV source.
 
- 
CSVReaderConstructs CSVReader with supplied separator.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries.
 
- 
CSVReaderConstructs CSVReader with supplied separator and quote char.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
 
- 
CSVReaderConstructs CSVReader with supplied separator, quote char and quote handling behavior.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
- strictQuotes- sets if characters outside the quotes are ignored
 
- 
CSVReaderConstructs CSVReader with supplied separator and quote char.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
- escape- the character to use for escaping a separator or quote
 
- 
CSVReaderConstructs CSVReader with supplied separator and quote char.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
- line- the line number to skip for start reading
 
- 
CSVReaderConstructs CSVReader with supplied separator and quote char.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
- escape- the character to use for escaping a separator or quote
- line- the line number to skip for start reading
 
- 
CSVReaderpublic CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes) Constructs CSVReader with supplied separator and quote char.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
- escape- the character to use for escaping a separator or quote
- line- the line number to skip for start reading
- strictQuotes- sets if characters outside the quotes are ignored
 
- 
CSVReaderpublic CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) Constructs CSVReader with supplied separator and quote char.- Parameters:
- reader- the reader to an underlying CSV source.
- separator- the delimiter to use for separating entries
- quotechar- the character to use for quoted elements
- escape- the character to use for escaping a separator or quote
- line- the line number to skip for start reading
- strictQuotes- sets if characters outside the quotes are ignored
- ignoreLeadingWhiteSpace- it true, parser should ignore white space before a quote in a field
 
 
- 
- 
Method Details- 
readAllReads the entire file into a List with each element being a String[] of tokens.- Returns:
- a List of String[], with each String[] representing a line of the file.
- Throws:
- IOException- if bad things happen during the read
 
- 
readNextReads the next line from the buffer and converts to a string array.- Returns:
- a string array with each comma-separated element as a separate entry.
- Throws:
- IOException- if bad things happen during the read
 
- 
closeCloses the underlying reader.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException- if the close fails
 
- 
hasNextpublic boolean hasNext()
- 
next
- 
removepublic void remove()
 
-