Class SeekableInputStream

Object
java.io.InputStream
io.delta.kernel.defaults.engine.fileio.SeekableInputStream
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
HadoopSeekableInputStream

public abstract class SeekableInputStream extends InputStream
Extends InputStream to provide the current position in the stream and seek to a new position. Also provides additional utility methods such as readFully(byte[], int, int).
  • Constructor Details

    • SeekableInputStream

      public SeekableInputStream()
  • Method Details

    • getPos

      public abstract long getPos() throws IOException
      Get the current position in the stream.
      Returns:
      the current position in bytes from the start of the stream
      Throws:
      IOException - if the underlying stream throws an IOException
    • seek

      public abstract void seek(long newPos) throws IOException
      Seek to a new position in the stream.
      Parameters:
      newPos - the new position to seek to
      Throws:
      IOException - if the underlying stream throws an IOException
    • readFully

      public abstract void readFully(byte[] b, int off, int len) throws IOException
      Read fully len bytes into the buffer b.
      Parameters:
      b - byte array
      off - offset in the byte array
      len - number of bytes to read
      Throws:
      EOFException - – if this input stream reaches the end before reading all the bytes.
      IOException - – the stream has been closed and the contained input stream does not support reading after close, or another I/ O error occurs.