DataReader (ORC Core 1.6.5 API)
Date: 2020-10-01

org.apache.orc

## 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 Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataReader` | `clone()` Clone the entire state of the DataReader with the assumption that the clone will be closed at a different time.
    `void` | `close()`
    `InStream.StreamOptions` | `getCompressionOptions()` Returns the compression options used by this DataReader.
    `boolean` | `isTrackingDiskRanges()` Whether the user should release buffers created by readFileData.
    `void` | `open()` Opens the DataReader, making it ready to use.
    `BufferChunkList` | `readFileData(BufferChunkList range, boolean doForceDirect)` Reads the data from the file.
    `OrcProto.StripeFooter` | `readStripeFooter(StripeInformation stripe)`
    `void` | `releaseBuffer(ByteBuffer toRelease)` Releases buffers created by readFileData.

- - ### Method Detail

    - #### 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

          void releaseBuffer(ByteBuffer toRelease)

      Releases buffers created by readFileData. See readFileData javadoc.
      Parameters:
        `toRelease` - The buffer to release.

    - #### 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

Copyright © 2013–2020 The Apache Software Foundation. All rights reserved.