public abstract class DataReader extends DataEndpoint
readImpl(),
however, most subclasses will also override DataEndpoint.open() and DataEndpoint.close().DataEndpoint.State| Modifier and Type | Field and Description |
|---|---|
protected FieldLineage |
fieldLineage |
protected RecordLineage |
recordLineage |
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
DataReader() |
| Modifier and Type | Method and Description |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException. |
protected Record |
addLineage(Record record) |
int |
available()
Returns the number of records that can probably be read without blocking.
|
int |
getBufferSize()
Returns the number of records in this
DataReaders buffer. |
DataReader |
getNestedEndpoint()
Returns the
Endpoint held inside this one or null if there isn't one. |
DataReader |
getNestedReader()
Returns the
DataReader held inside this one or null if there isn't one. |
<T extends DataReader> |
getReader(Class<T> type)
Returns the first
DataReader of the specified type held inside this one or null if there isn't one. |
DataReader |
getRootEndpoint()
Returns the deepest, nested
Endpoint held inside this one, otherwise this instance is returned if
there aren't any nested Endpoints. |
DataReader |
getRootReader()
Returns the deepest, nested
DataReader held inside this one, otherwise this instance is returned if
there aren't any nested DataReaders. |
boolean |
isExhausted()
Returns
true if this stream has already returned a null indicating that no further reads are possible. |
boolean |
isLineageSupported() |
boolean |
isSaveLineage() |
Record |
peek(int index)
Looks ahead to return the next record at the specified index without reading it or
null if one does not exist. |
protected Record |
pop()
Removes and returns the next record in this
DataReaders buffer or null if it is empty. |
void |
push(Record record)
Adds a record to this
DataReaders buffer. |
Record |
read()
Reads the next record from this
DataReader and increases the record-count by 1. |
protected abstract Record |
readImpl()
Overridden by subclasses to read the next record from this
DataReader. |
DataReader |
setSaveLineage(boolean saveLineage) |
int |
skip(int count)
Skips over the specified number of records.
|
close, decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, open, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptionprotected final RecordLineage recordLineage
protected final FieldLineage fieldLineage
public DataReader getNestedEndpoint()
EndpointEndpoint held inside this one or null if there isn't one.getNestedEndpoint in class DataEndpointpublic DataReader getRootEndpoint()
EndpointEndpoint held inside this one, otherwise this instance is returned if
there aren't any nested Endpoints.getRootEndpoint in class DataEndpointpublic DataReader getNestedReader()
DataReader held inside this one or null if there isn't one.public <T extends DataReader> T getReader(Class<T> type)
DataReader of the specified type held inside this one or null if there isn't one.public DataReader getRootReader()
DataReader held inside this one, otherwise this instance is returned if
there aren't any nested DataReaders.public int available()
throws DataException
DataExceptionpublic final int getBufferSize()
DataReaders buffer.public boolean isExhausted()
true if this stream has already returned a null indicating that no further reads are possible.public void push(Record record)
DataReaders buffer. Records in the buffer will be returned
by read() before attempting to read from the underlying implementation.read()protected Record pop()
DataReaders buffer or null if it is empty.push(Record)public final Record peek(int index)
null if one does not exist.
The buffer of look ahead records are added to this DataReader using push(Record).index - specifies how far to look ahead (0 refers to the next record, 1--to the one after that, etc.)null if one does not existprotected abstract Record readImpl() throws Throwable
DataReader. The default
implementation of 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.
Throwablepublic Record read() throws DataException
DataReader and increases the record-count by 1.
This method will first read any pushed (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 readImpl().
DataExceptionpush(Record),
peek(int),
read()public int skip(int count)
throws DataException
count - the number of records to skipDataExceptionpublic boolean isLineageSupported()
public boolean isSaveLineage()
public DataReader setSaveLineage(boolean saveLineage)
public DataException addExceptionProperties(DataException exception)
EndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class DataEndpointCopyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.