Interface Seekable

All Known Implementing Classes:
BlockDecompressorStream, CompressionInputStream, DecompressorStream, FSDataInputStream, FSInputStream, HdfsDataInputStream, SplitCompressionInputStream

@Public @Evolving public interface Seekable
Stream that permits seeking.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Return the current offset from the start of the file
    void
    seek(long pos)
    Seek to the given offset from the start of the file.
    boolean
    seekToNewSource(long targetPos)
    Seeks a different copy of the data.
  • Method Details

    • seek

      void seek(long pos) throws IOException
      Seek to the given offset from the start of the file. The next read() will be from that location. Can't seek past the end of the file.
      Parameters:
      pos - offset from the start of the file.
      Throws:
      IOException - raised on errors performing I/O.
    • getPos

      long getPos() throws IOException
      Return the current offset from the start of the file
      Returns:
      offset from the start of the file.
      Throws:
      IOException - raised on errors performing I/O.
    • seekToNewSource

      @Private boolean seekToNewSource(long targetPos) throws IOException
      Seeks a different copy of the data. Returns true if found a new source, false otherwise.
      Parameters:
      targetPos - target position.
      Returns:
      true if found a new source, false otherwise.
      Throws:
      IOException - raised on errors performing I/O.