Package org.apache.orc
Interface DataReader
- All Superinterfaces:
AutoCloseable
,Cloneable
An abstract data reader that IO formats can use to read bytes from underlying storage.
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Clone the entire state of the DataReader with the assumption that the clone will be closed at a different time.void
close()
Returns the compression options used by this DataReader.boolean
Whether the user should release buffers created by readFileData.void
open()
Opens the DataReader, making it ready to use.readFileData
(BufferChunkList range, boolean doForceDirect) Reads the data from the file.readStripeFooter
(StripeInformation stripe) void
Releases all buffers created by readFileData.void
releaseBuffer
(ByteBuffer toRelease) Deprecated.
-
Method Details
-
open
Opens the DataReader, making it ready to use.- Throws:
IOException
-
readFileData
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.UsereleaseAllBuffers()
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
- Specified by:
close
in interfaceAutoCloseable
- 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
-
releaseAllBuffers()
instead.