Interface DataReader

All Superinterfaces:
AutoCloseable, Cloneable

public interface DataReader extends AutoCloseable, Cloneable
An abstract data reader that IO formats can use to read bytes from underlying storage.
  • Method Details

    • open

      void open() throws IOException
      Opens the DataReader, making it ready to use.
      Throws:
      IOException
    • readStripeFooter

      OrcProto.StripeFooter readStripeFooter(StripeInformation stripe) throws IOException
      Throws:
      IOException
    • readFileData

      BufferChunkList readFileData(BufferChunkList range, boolean doForceDirect) throws IOException
      Reads the data from the file. Note that for the cases such as zero-copy read, caller must release the disk ranges produced after being done with them. Call isTrackingDiskRanges to find out if this is needed.
      Parameters:
      range - List of disk ranges to read. Ranges with data will be ignored.
      doForceDirect - Whether the data should be read into direct buffers.
      Returns:
      The list range with buffers filled in
      Throws:
      IOException
    • isTrackingDiskRanges

      boolean isTrackingDiskRanges()
      Whether the user should release buffers created by readFileData. See readFileData javadoc.
    • releaseBuffer

      @Deprecated void releaseBuffer(ByteBuffer toRelease)
      Deprecated.
      Use releaseAllBuffers() instead. This method was incorrectly used by upper level code and shouldn't be used anymore.
      Releases buffers created by readFileData. See readFileData javadoc.
      Parameters:
      toRelease - The buffer to release.
    • releaseAllBuffers

      void releaseAllBuffers()
      Releases all buffers created by readFileData. See readFileData javadoc.
    • clone

      DataReader clone()
      Clone the entire state of the DataReader with the assumption that the clone will be closed at a different time. Thus, any file handles in the implementation need to be cloned.
      Returns:
      a new instance
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • getCompressionOptions

      InStream.StreamOptions getCompressionOptions()
      Returns the compression options used by this DataReader. The codec if present is owned by the DataReader and should not be returned to the OrcCodecPool.
      Returns:
      the compression options