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.| 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
FileBasedReader#startReading(ReadableByteChannel). |
advanceImpl, close, getCurrentSource, startImpladvance, getFractionConsumed, splitAtFraction, startgetCurrentTimestamppublic CompressedReader(CompressedSource<T> source, FileBasedSource.FileBasedReader<T> readerDelegate)
CompressedReader from a CompressedSource and delegate reader.public T getCurrent() throws NoSuchElementException
getCurrent in class Source.Reader<T>NoSuchElementException - if Source.Reader.start() was never called, or if
the last Source.Reader.start() or Source.Reader.advance() returned false.protected final boolean isAtSplitPoint()
isAtSplitPoint in class OffsetBasedSource.OffsetBasedReader<T>protected final void startReading(ReadableByteChannel channel) throws IOException
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 OffsetBasedSource.OffsetBasedReader<T>