T - type of recordspublic abstract class AbstractRandomAccessReader<T> extends Object implements cc.redberry.pipe.OutputPort<T>
| Modifier and Type | Field and Description |
|---|---|
protected long |
currentRecordNumber
Current record number, i.e.
|
protected RandomAccessFile |
file
Random access file
|
protected FileIndex |
fileIndex
Index of file
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRandomAccessReader(FileIndex fileIndex,
RandomAccessFile file) |
| Modifier and Type | Method and Description |
|---|---|
long |
getCurrentRecordNumber()
Returns the number of record that will be returned on
take() |
protected void |
resetBufferOnSeek() |
void |
seekToRecord(long recordNumber)
Sets the file-pointer offset, measured from the beginning of this file, at which the next record occurs.
|
protected void |
skip() |
T |
take()
Returns the next record or null if no more records exist.
|
T |
take(long recordNumber)
Returns the specified record or null if
recordNumber is greater than actual number of records in file. |
protected abstract T |
take0() |
protected final FileIndex fileIndex
protected final RandomAccessFile file
protected long currentRecordNumber
protected AbstractRandomAccessReader(FileIndex fileIndex, RandomAccessFile file)
public long getCurrentRecordNumber()
take()take()public void seekToRecord(long recordNumber)
throws IOException
recordNumber - number of record, at which to set the file pointer.IOException - if pos is less than 0 or if an I/O error occurs.public T take(long recordNumber) throws IOException
recordNumber is greater than actual number of records in file.recordNumber - record numberrecordNumber is greater than actual number of records in
fileIOException - if I/O occurspublic T take()
take in interface cc.redberry.pipe.OutputPort<T>protected void resetBufferOnSeek()
protected void skip()
protected abstract T take0()
Copyright © 2018. All rights reserved.