T - The type of records read from the source.public static class CompressedSource.CompressedReader<T> extends FileBasedSource.FileBasedReader<T>
CompressedSource. Decompresses its input and uses a delegate
reader to read elements from the decompressed input.rangeTracker| Constructor and Description |
|---|
CompressedReader(CompressedSource<T> source,
FileBasedSource.FileBasedReader<T> readerDelegate)
Create a
CompressedReader from a CompressedSource and delegate reader. |
| Modifier and Type | Method and Description |
|---|---|
T |
getCurrent()
Gets the current record from the delegate reader.
|
protected long |
getCurrentOffset()
Returns the delegate reader's current offset in the decompressed input.
|
protected boolean |
isAtSplitPoint()
Returns true only for the first record; compressed sources cannot be split.
|
protected boolean |
readNextRecord()
Reads the next record via the delegate reader.
|
protected void |
startReading(ReadableByteChannel channel)
Creates a decompressing channel from the input channel and passes it to its delegate reader's
FileBasedSource.FileBasedReader.startReading(ReadableByteChannel). |
advance, close, getCurrentSource, startgetFractionConsumed, splitAtFractiongetCurrentTimestampclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCurrentTimestamppublic CompressedReader(CompressedSource<T> source, FileBasedSource.FileBasedReader<T> readerDelegate)
CompressedReader from a CompressedSource and delegate reader.public T getCurrent() throws NoSuchElementException
NoSuchElementException - if the reader is at the beginning of the input and
Source.Reader.start() or Source.Reader.advance() wasn't called, or if the last Source.Reader.start() or
Source.Reader.advance() returned false.protected final boolean isAtSplitPoint()
isAtSplitPoint in class FileBasedSource.FileBasedReader<T>protected final void startReading(ReadableByteChannel channel) throws IOException
FileBasedSource.FileBasedReader.startReading(ReadableByteChannel).startReading in class FileBasedSource.FileBasedReader<T>channel - a byte channel representing the file backing the reader.IOExceptionprotected final boolean readNextRecord()
throws IOException
readNextRecord in class FileBasedSource.FileBasedReader<T>true if a record was successfully read, false if the end of the
channel was reached before successfully reading a new record.IOExceptionprotected final long getCurrentOffset()
getCurrentOffset in class ByteOffsetBasedSource.ByteOffsetBasedReader<T>