org.apache.avro.file
Interface FileReader<D>

All Superinterfaces:
Closeable, Iterable<D>, Iterator<D>
All Known Implementing Classes:
DataFileReader, SequenceFileReader

public interface FileReader<D>
extends Iterator<D>, Iterable<D>, Closeable

Interface for reading data from a file.


Method Summary
 Schema getSchema()
          Return the schema for data in this file.
 D next(D reuse)
          Read the next datum from the file.
 boolean pastSync(long position)
          Return true if past the next synchronization point after a position.
 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 interface java.util.Iterator
hasNext, next, remove
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

getSchema

Schema getSchema()
Return the schema for data in this file.


next

D next(D reuse)
       throws IOException
Read the next datum from the file.

Parameters:
reuse - an instance to reuse.
Throws:
NoSuchElementException - if no more remain in the file.
IOException

sync

void sync(long position)
          throws IOException
Move to the next synchronization point after a position. To process a range of file entires, call this with the starting position, then check pastSync(long) with the end point before each call to Iterator.next().

Throws:
IOException

pastSync

boolean pastSync(long position)
                 throws IOException
Return true if past the next synchronization point after a position.

Throws:
IOException

tell

long tell()
          throws IOException
Return the current position in the input.

Throws:
IOException


Copyright © 2010 The Apache Software Foundation