org.apache.avro.file

## Class DataFileReader12<D>

- java.lang.Object
- - org.apache.avro.file.DataFileReader12<D>

All Implemented Interfaces:
  Closeable, AutoCloseable, Iterable<D>, Iterator<D>, FileReader<D>

    public class DataFileReader12<D>
    extends Object
    implements FileReader<D>, Closeable

Read files written by Avro version 1.2.

### Constructor Summary

Constructors
Constructor and Description
`DataFileReader12(SeekableInput sin, DatumReader<D> reader)` Construct a reader for a file.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close this reader.
`byte[]` `getMeta(String key)` Return the value of a metadata property.
`long` `getMetaLong(String key)` Return the value of a metadata property.
`String` `getMetaString(String key)` Return the value of a metadata property.
`Schema` `getSchema()` Return the schema used in this file.
`boolean` `hasNext()`
`Iterator<D>` `iterator()`
`D` `next()`
`D` `next(D reuse)` Return the next datum in the file.
`boolean` `pastSync(long position)` Return true if past the next synchronization point after a position.
`void` `remove()`
`void` `seek(long position)` Move to the specified synchronization point, as returned by `DataFileWriter.sync()`.
`void` `sync(long position)` Move to the next synchronization point after a position.
`long` `tell()` Return the current position in the input.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Iterator

`forEachRemaining`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### DataFileReader12

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

Construct a reader for a file.

Throws:
  `IOException`

### Method Detail

#### getMeta

    public byte[] getMeta(String key)

Return the value of a metadata property.

#### getMetaString

    public String getMetaString(String key)

Return the value of a metadata property.

#### getMetaLong

    public long getMetaLong(String key)

Return the value of a metadata property.

#### getSchema

    public Schema getSchema()

Return the schema used in this file.

Specified by:
  `getSchema` in interface `FileReader<D>`

#### iterator

    public Iterator<D> iterator()

Specified by:
  `iterator` in interface `Iterable<D>`

#### hasNext

    public boolean hasNext()

Specified by:
  `hasNext` in interface `Iterator<D>`

#### next

    public D next()

Specified by:
  `next` in interface `Iterator<D>`

#### remove

    public void remove()

Specified by:
  `remove` in interface `Iterator<D>`

#### next

    public D next(D reuse)
           throws IOException

Return the next datum in the file.

Specified by:
  `next` in interface `FileReader<D>`
Parameters:
  `reuse` - an instance to reuse.
Throws:
  `IOException`

#### seek

    public void seek(long position)
              throws IOException

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

Throws:
  `IOException`

#### sync

    public void sync(long position)
              throws IOException

Move to the next synchronization point after a position.

Specified by:
  `sync` in interface `FileReader<D>`
Throws:
  `IOException`

#### pastSync

    public boolean pastSync(long position)
                     throws IOException

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

Specified by:
  `pastSync` in interface `FileReader<D>`
Throws:
  `IOException`

#### tell

    public long tell()
              throws IOException

Return the current position in the input.

Specified by:
  `tell` in interface `FileReader<D>`
Throws:
  `IOException`

#### close

    public void close()
               throws IOException

Close this reader.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `IOException`