Interface FileReader<D>

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

public interface FileReader<D> extends Iterator<D>, Iterable<D>, Closeable
Interface for reading data from a file.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the schema for data in this file.
    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
    Return the current position in the input.

    Methods inherited from interface java.io.Closeable

    close

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods inherited from interface java.util.Iterator

    forEachRemaining, hasNext, next, remove
  • Method Details

    • 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