public abstract class AbstractReader extends DataReader
fillRecord(Record)
.DataEndpoint.State
Modifier and Type | Field and Description |
---|---|
protected Record |
currentRecord |
protected String[] |
fieldNames |
protected int |
lastRow |
protected int |
startingRow |
fieldLineage, recordLineage
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
AbstractReader() |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
protected abstract boolean |
fillRecord(Record record) |
String[] |
getFieldNames() |
int |
getLastRow() |
int |
getStartingRow() |
boolean |
isFieldNamesInFirstRow() |
boolean |
isSkipEmptyRows()
Indicates that rows with only null values should not be returned by the reader (default is false).
|
void |
open()
Makes this endpoint ready for reading or writing.
|
Record |
read()
Reads the next record from this
DataReader and increases the record-count by 1. |
protected Record |
readImpl()
Overridden by subclasses to read the next record from this
DataReader . |
AbstractReader |
setFieldNames(Collection<String> fieldNames) |
AbstractReader |
setFieldNames(String... fieldNames) |
AbstractReader |
setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) |
AbstractReader |
setLastRow(int lastRow) |
AbstractReader |
setSkipEmptyRows(boolean skipEmptyRows)
Indicates that rows with only null values should not be returned by the reader (default is false).
|
AbstractReader |
setStartingRow(int startingRow) |
addLineage, available, getBufferSize, getNestedEndpoint, getNestedReader, getRootEndpoint, getRootReader, isExhausted, isLineageSupported, isSaveLineage, peek, pop, push, setSaveLineage, skip
close, decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
protected String[] fieldNames
protected Record currentRecord
protected int startingRow
protected int lastRow
public DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class DataReader
public boolean isFieldNamesInFirstRow()
public AbstractReader setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
public String[] getFieldNames()
public AbstractReader setFieldNames(String... fieldNames)
public AbstractReader setFieldNames(Collection<String> fieldNames)
public AbstractReader setStartingRow(int startingRow)
public int getStartingRow()
public AbstractReader setLastRow(int lastRow)
public int getLastRow()
public AbstractReader setSkipEmptyRows(boolean skipEmptyRows)
public boolean isSkipEmptyRows()
public void open() throws DataException
DataEndpoint
open
in class DataEndpoint
DataException
public Record read() throws DataException
DataReader
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 reading will be converted to a DataException
using DataObject.exception(Throwable)
.
Subclasses generally do not need to override this method, instead they should implement DataReader.readImpl()
.
read
in class DataReader
DataException
DataReader.push(Record)
,
DataReader.peek(int)
,
DataReader.read()
protected Record readImpl() throws Throwable
DataReader
DataReader
. The default
implementation of DataReader.read()
now insures that this method will not be called again after it returns
a null
.
If no record is available, null
will be returned.
readImpl
in class DataReader
Throwable
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.