Package adams.data.io.input
Class FastCsvSpreadSheetReader.ChunkReader
- java.lang.Object
-
- adams.data.io.input.FastCsvSpreadSheetReader.ChunkReader
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- FastCsvSpreadSheetReader
public static class FastCsvSpreadSheetReader.ChunkReader extends Object implements Serializable
Reads CSV files chunk by chunk.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_ChunkSizethe chunk size to use.protected Stringm_CustomColumnHeadersthe comma-separated list of column header names.protected intm_FirstRowthe first row to retrieve (1-based).protected SpreadSheetm_Headerthe header.protected BaseRegExpm_MissingValuethe missing value.protected booleanm_NoHeaderwhether the file has a header or not.protected boolean[]m_NumericColsthe numeric columns.protected Rangem_NumericColumnsthe columns to treat as numeric.protected intm_NumRowsthe number of rows to retrieve (less than 1 = unlimited).protected FastCsvSpreadSheetReaderm_Ownerthe owning reader.protected Stringm_QuoteCharacterthe quote character.protected BufferedReaderm_Readerthe reader in use.protected intm_RowCountthe rows read so far.protected Stringm_Separatorthe column separator.protected booleanm_Trimwhether to trim the cell content.
-
Constructor Summary
Constructors Constructor Description ChunkReader(FastCsvSpreadSheetReader owner)Initializes the low-level reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclose()Closes the reader.booleanhasNext()Returns whether there is more data to be read.SpreadSheetnext()Reads the next chunk.SpreadSheetread(Reader r)Reads the spreadsheet content from the specified reader.
-
-
-
Field Detail
-
m_Owner
protected FastCsvSpreadSheetReader m_Owner
the owning reader.
-
m_Reader
protected BufferedReader m_Reader
the reader in use.
-
m_Header
protected SpreadSheet m_Header
the header.
-
m_MissingValue
protected BaseRegExp m_MissingValue
the missing value.
-
m_QuoteCharacter
protected String m_QuoteCharacter
the quote character.
-
m_Separator
protected String m_Separator
the column separator.
-
m_NumericColumns
protected Range m_NumericColumns
the columns to treat as numeric.
-
m_NumericCols
protected boolean[] m_NumericCols
the numeric columns.
-
m_Trim
protected boolean m_Trim
whether to trim the cell content.
-
m_NoHeader
protected boolean m_NoHeader
whether the file has a header or not.
-
m_CustomColumnHeaders
protected String m_CustomColumnHeaders
the comma-separated list of column header names.
-
m_FirstRow
protected int m_FirstRow
the first row to retrieve (1-based).
-
m_NumRows
protected int m_NumRows
the number of rows to retrieve (less than 1 = unlimited).
-
m_ChunkSize
protected int m_ChunkSize
the chunk size to use.
-
m_RowCount
protected int m_RowCount
the rows read so far.
-
-
Constructor Detail
-
ChunkReader
public ChunkReader(FastCsvSpreadSheetReader owner)
Initializes the low-level reader.- Parameters:
owner- the owning reader
-
-
Method Detail
-
close
protected void close()
Closes the reader.
-
hasNext
public boolean hasNext()
Returns whether there is more data to be read.- Returns:
- true if more data available
-
next
public SpreadSheet next()
Reads the next chunk.- Returns:
- the next chunk
-
read
public SpreadSheet read(Reader r)
Reads the spreadsheet content from the specified reader.- Parameters:
r- the reader to read from- Returns:
- the spreadsheet or null in case of an error
-
-