Top Description Fields Constructors Methods
org.apache.avro.file

public Class DataFileReader12<D>

extends Object
implements FileReader<D>, Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable, org.apache.avro.file.FileReader, java.lang.Iterable, java.util.Iterator
Imports
java.io.IOException, .Closeable, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, java.util.Arrays, .HashMap, .Iterator, .Map, org.apache.avro.InvalidAvroMagicException, .Schema, .UnknownAvroCodecException, org.apache.avro.io.DatumReader, .DecoderFactory, .BinaryDecoder

Read files written by Avro version 1.2.

Field Summary

Modifier and TypeField and Description
private long
private long
private static final String
private DataFileReader.SeekableInputStream
pack-priv static final byte[]
private Map<String, byte[]>
private static final String
private D
private DatumReader<D>
private static final String
private Schema
private static final String
private byte[]
private static final int
private byte[]
private static final byte
private BinaryDecoder

Constructor Summary

AccessConstructor and Description
public
DataFileReader12(SeekableInput sin, DatumReader<D> reader)

Construct a reader for a file.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Implements java.io.Closeable.close.

Close this reader.
public synchronized byte[]
getMeta(String key)

Return the value of a metadata property.

public synchronized long
getMetaLong(String key)

Return the value of a metadata property.

public synchronized String
getMetaString(String key)

Return the value of a metadata property.

public Schema
getSchema()

Implements org.apache.avro.file.FileReader.getSchema.

Return the schema used in this file.
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Iterator<D>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public D
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public synchronized D
next(D
an instance to reuse.
reuse
)

Implements org.apache.avro.file.FileReader.next.

Return the next datum in the file.
public boolean
pastSync(long position)

Implements org.apache.avro.file.FileReader.pastSync.

Return true if past the next synchronization point after a position.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
public synchronized void
seek(long position)

Move to the specified synchronization point, as returned by DataFileWriter#sync().

private void
public synchronized void
sync(long position)

Implements org.apache.avro.file.FileReader.sync.

Move to the next synchronization point after a position.
public long
tell()

Implements org.apache.avro.file.FileReader.tell.

Return the current position in the input.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockCountback to summary
private long blockCount
blockStartback to summary
private long blockStart
CODECback to summary
private static final String CODEC
inback to summary
private DataFileReader.SeekableInputStream in
MAGICback to summary
pack-priv static final byte[] MAGIC
metaback to summary
private Map<String, byte[]> meta
NULL_CODECback to summary
private static final String NULL_CODEC
peekback to summary
private D peek
readerback to summary
private DatumReader<D> reader
SCHEMAback to summary
private static final String SCHEMA
schemaback to summary
private Schema schema
SYNCback to summary
private static final String SYNC
syncback to summary
private byte[] sync
SYNC_SIZEback to summary
private static final int SYNC_SIZE
syncBufferback to summary
private byte[] syncBuffer
VERSIONback to summary
private static final byte VERSION
vinback to summary
private BinaryDecoder vin

Constructor Detail

DataFileReader12back to summary
public DataFileReader12(SeekableInput sin, DatumReader<D> reader) throws IOException

Construct a reader for a file.

Method Detail

closeback to summary
public synchronized void close() throws IOException

Implements java.io.Closeable.close.

Close this reader.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Closeable.close.

if an I/O error occurs

getMetaback to summary
public synchronized byte[] getMeta(String key)

Return the value of a metadata property.

getMetaLongback to summary
public synchronized long getMetaLong(String key)

Return the value of a metadata property.

getMetaStringback to summary
public synchronized String getMetaString(String key)

Return the value of a metadata property.

getSchemaback to summary
public Schema getSchema()

Implements org.apache.avro.file.FileReader.getSchema.

Return the schema used in this file.

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
iteratorback to summary
public Iterator<D> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<D>

an Iterator.

Annotations
@Override
nextback to summary
public D next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:D

the next element in the iteration

Annotations
@Override
nextback to summary
public synchronized D next(D reuse) throws IOException

Implements org.apache.avro.file.FileReader.next.

Return the next datum in the file.

Parameters
reuse:D

Doc from org.apache.avro.file.FileReader.next.

an instance to reuse.

Annotations
@Override
pastSyncback to summary
public boolean pastSync(long position) throws IOException

Implements org.apache.avro.file.FileReader.pastSync.

Return true if past the next synchronization point after a position.

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
seekback to summary
public synchronized void seek(long position) throws IOException

Move to the specified synchronization point, as returned by DataFileWriter#sync().

skipSyncback to summary
private void skipSync() throws IOException
syncback to summary
public synchronized void sync(long position) throws IOException

Implements org.apache.avro.file.FileReader.sync.

Move to the next synchronization point after a position.

Annotations
@Override
tellback to summary
public long tell() throws IOException

Implements org.apache.avro.file.FileReader.tell.

Return the current position in the input.

Annotations
@Override