Package overit.geocall.util
Class CsvBufferedReader
java.lang.Object
java.io.Reader
java.io.BufferedReader
overit.geocall.util.CsvBufferedReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
Reads text from a character-input stream, buffering characters so as to
provide for the efficient reading of characters, arrays, and lines for CVS.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected charprotected Stringprotected charstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionCreates a buffering character-input stream that uses a default-sized input buffer.CsvBufferedReader(Reader in, int sz) Creates a buffering character-input stream that uses an input buffer of the specified size. -
Method Summary
Modifier and TypeMethodDescriptionprotected intcountQuote(String s) Read the CSV linevoidsetEmptyLineManagement(int mode) Sets the empty line management.voidsetQuote(char c) Sets the quotevoidsetSeparator(char c) Sets the separatorMethods inherited from class java.io.BufferedReader
close, lines, mark, markSupported, read, read, readLine, ready, reset, skipMethods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
Field Details
-
EMPTYLINE_STOP
public static final int EMPTYLINE_STOP- See Also:
-
EMPTYLINE_SKIP
public static final int EMPTYLINE_SKIP- See Also:
-
EMPTYLINE_RETURN
public static final int EMPTYLINE_RETURN- See Also:
-
_sep
protected char _sep -
_quote
protected char _quote -
_quotesep
-
_emptyLineManagement
protected int _emptyLineManagement
-
-
Constructor Details
-
CsvBufferedReader
Creates a buffering character-input stream that uses a default-sized input buffer.- Parameters:
in- A Reader
-
CsvBufferedReader
Creates a buffering character-input stream that uses an input buffer of the specified size.- Parameters:
in- A Readersz- Input-buffer size
-
-
Method Details
-
setEmptyLineManagement
public void setEmptyLineManagement(int mode) Sets the empty line management. Possible values are: 0: EMPTYLINE_STOP (default one) 1: EMPTYLINE_SKIP 2: EMPTYLINE_RETURN- Parameters:
mode- The mode selected
-
setSeparator
public void setSeparator(char c) Sets the separator- Parameters:
c- The separator
-
setQuote
public void setQuote(char c) Sets the quote- Parameters:
c- The quote
-
countQuote
-
readCsvLine
Read the CSV line- Returns:
- An ArrayList of string with the CSV
- Throws:
IOException- if an I/O error occurs
-