Class AvroSource.AvroReader<T>
- java.lang.Object
-
- org.apache.beam.sdk.io.Source.Reader<T>
-
- org.apache.beam.sdk.io.BoundedSource.BoundedReader<T>
-
- org.apache.beam.sdk.io.OffsetBasedSource.OffsetBasedReader<T>
-
- org.apache.beam.sdk.io.FileBasedSource.FileBasedReader<T>
-
- org.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader<T>
-
- org.apache.beam.sdk.extensions.avro.io.AvroSource.AvroReader<T>
-
- Type Parameters:
T- The type of records contained in the block.
- All Implemented Interfaces:
java.lang.AutoCloseable
- Enclosing class:
- AvroSource<T>
public static class AvroSource.AvroReader<T> extends org.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader<T>ABlockBasedSource.BlockBasedReaderfor reading blocks from Avro files.An Avro Object Container File consists of a header followed by a 16-bit sync marker and then a sequence of blocks, where each block begins with two encoded longs representing the total number of records in the block and the block's size in bytes, followed by the block's (optionally-encoded) records. Each block is terminated by a 16-bit sync marker.
-
-
Constructor Summary
Constructors Constructor Description AvroReader(AvroSource<T> source)Reads Avro records of typeTfrom the specified source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.beam.sdk.extensions.avro.io.AvroSource.AvroBlock<T>getCurrentBlock()longgetCurrentBlockOffset()longgetCurrentBlockSize()AvroSource<T>getCurrentSource()longgetSplitPointsRemaining()booleanreadNextBlock()protected voidstartReading(java.nio.channels.ReadableByteChannel channel)-
Methods inherited from class org.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader
getCurrent, getCurrentOffset, getFractionConsumed, isAtSplitPoint, readNextRecord
-
Methods inherited from class org.apache.beam.sdk.io.FileBasedSource.FileBasedReader
advanceImpl, allowsDynamicSplitting, close, startImpl
-
-
-
-
Constructor Detail
-
AvroReader
public AvroReader(AvroSource<T> source)
Reads Avro records of typeTfrom the specified source.
-
-
Method Detail
-
getCurrentSource
public AvroSource<T> getCurrentSource()
- Overrides:
getCurrentSourcein classorg.apache.beam.sdk.io.FileBasedSource.FileBasedReader<T>
-
readNextBlock
public boolean readNextBlock()
- Specified by:
readNextBlockin classorg.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader<T>
-
getCurrentBlock
public org.apache.beam.sdk.extensions.avro.io.AvroSource.AvroBlock<T> getCurrentBlock()
- Specified by:
getCurrentBlockin classorg.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader<T>
-
getCurrentBlockOffset
public long getCurrentBlockOffset()
- Specified by:
getCurrentBlockOffsetin classorg.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader<T>
-
getCurrentBlockSize
public long getCurrentBlockSize()
- Specified by:
getCurrentBlockSizein classorg.apache.beam.sdk.io.BlockBasedSource.BlockBasedReader<T>
-
getSplitPointsRemaining
public long getSplitPointsRemaining()
- Overrides:
getSplitPointsRemainingin classorg.apache.beam.sdk.io.OffsetBasedSource.OffsetBasedReader<T>
-
startReading
protected void startReading(java.nio.channels.ReadableByteChannel channel) throws java.io.IOException- Specified by:
startReadingin classorg.apache.beam.sdk.io.FileBasedSource.FileBasedReader<T>- Throws:
java.io.IOException
-
-