|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.northconcepts.datapipeline.core.DataEndpoint
com.northconcepts.datapipeline.core.DataReader
public abstract class DataReader
Abstract super-class for reading records. The only method that a subclass must implement is readImpl(),
however, most subclasses will also override DataEndpoint.open() and DataEndpoint.close().
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
|---|
DataEndpoint.State |
| Field Summary |
|---|
| Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
|---|
BUFFER_SIZE, log |
| Constructor Summary | |
|---|---|
DataReader()
|
|
| Method Summary | |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a DataException. |
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 |
getNestedReader()
Returns the DataReader held inside this one or null if there isn't one. |
DataReader |
getRootReader()
Returns the deepest, nested DataReader held inside this one, otherwise this instance is returned if
there aren't any nested DataReaders. |
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. |
int |
skip(int count)
Skips over the specified number of records. |
| Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint |
|---|
assertNotOpened, assertOpened, close, decrementRecordCount, exception, exception, exception, finalize, getDescription, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, open, resetRecordCount, setDescription, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DataReader()
| Method Detail |
|---|
public DataReader getNestedReader()
DataReader 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 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 exist
protected abstract Record readImpl()
throws Throwable
DataReader.
If no record is available, null will be returned.
Throwable
public 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 writing will be converted to a DataException using DataEndpoint.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 skip
DataExceptionpublic DataException addExceptionProperties(DataException exception)
DataEndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.
addExceptionProperties in class DataEndpoint
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||