com.northconcepts.datapipeline.core
Class AbstractReader
java.lang.Object
com.northconcepts.datapipeline.core.DataEndpoint
com.northconcepts.datapipeline.core.DataReader
com.northconcepts.datapipeline.core.AbstractReader
- Direct Known Subclasses:
- ExcelReader, ParsingReader, TextReader
public abstract class AbstractReader
- extends DataReader
Abstract super-class, with some common logic, for reading records. The only method subclasses must implement is fillRecord(Record).
| Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
assertNotOpened, assertOpened, close, decrementRecordCount, exception, exception, exception, finalize, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, toString |
fieldNames
protected String[] fieldNames
currentRecord
protected Record currentRecord
startingRow
protected int startingRow
lastRow
protected int lastRow
AbstractReader
public AbstractReader()
addExceptionProperties
public DataException addExceptionProperties(DataException exception)
- Description copied from class:
DataEndpoint
- Adds this endpoint's current state to a
DataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.
- Overrides:
addExceptionProperties in class DataReader
isFieldNamesInFirstRow
public boolean isFieldNamesInFirstRow()
setFieldNamesInFirstRow
public AbstractReader setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
getFieldNames
public String[] getFieldNames()
setFieldNames
public AbstractReader setFieldNames(String... fieldNames)
setStartingRow
public void setStartingRow(int startingRow)
getStartingRow
public int getStartingRow()
setLastRow
public void setLastRow(int lastRow)
getLastRow
public int getLastRow()
open
public void open()
throws DataException
- Description copied from class:
DataEndpoint
- Makes this endpoint ready for reading or writing.
- Overrides:
open in class DataEndpoint
- Throws:
DataException
read
public Record read()
throws DataException
- Description copied from class:
DataReader
- Reads the next record from this
DataReader and increases the record-count by 1.
This method will first read any pushed (DataReader.push(Record)) records before reading from the underlying source.
If no record is available, null will be returned. This method blocks until a record is available,
the end of the stream is reached, or an exception is thrown.
Any exception raised while writing will be converted to a DataException using DataEndpoint.exception(Throwable).
Subclasses generally do not need to override this method, instead they should implement DataReader.readImpl().
- Overrides:
read in class DataReader
- Throws:
DataException- See Also:
DataReader.push(Record),
DataReader.peek(int),
DataReader.read()
readImpl
protected Record readImpl()
throws Throwable
- Description copied from class:
DataReader
- Overridden by subclasses to read the next record from this
DataReader.
If no record is available, null will be returned.
- Specified by:
readImpl in class DataReader
- Throws:
Throwable
fillRecord
protected abstract boolean fillRecord(Record record)
throws Throwable
- Throws:
Throwable
Copyright (c) 2007-2009 North Concepts Inc. All Rights Reserved.