public abstract class SeekableInputStream extends InputStream
SeekableInputStream is an interface with the methods needed by
Parquet to read data from a file or Hadoop data stream.| Constructor and Description |
|---|
SeekableInputStream() |
| Modifier and Type | Method and Description |
|---|---|
abstract long |
getPos()
Return the current position in the InputStream.
|
abstract int |
read(ByteBuffer buf)
Read
buf.remaining() bytes of data into a ByteBuffer. |
abstract void |
readFully(byte[] bytes)
Read a byte array of data, from position 0 to the end of the array.
|
abstract void |
readFully(byte[] bytes,
int start,
int len)
Read
len bytes of data into an array, at position start. |
abstract void |
readFully(ByteBuffer buf)
Read
buf.remaining() bytes of data into a ByteBuffer. |
void |
readVectored(List<ParquetFileRange> ranges,
ByteBufferAllocator allocator)
Read a set of disjoint file ranges in a vectored manner.
|
boolean |
readVectoredAvailable(ByteBufferAllocator allocator)
Is the
readVectored(List, ByteBufferAllocator) method available? |
abstract void |
seek(long newPos)
Seek to a new position in the InputStream.
|
available, close, mark, markSupported, read, read, read, reset, skippublic abstract long getPos()
throws IOException
IOException - If the underlying stream throws IOExceptionpublic abstract void seek(long newPos)
throws IOException
newPos - the new position to seek toIOException - If the underlying stream throws IOExceptionpublic abstract void readFully(byte[] bytes)
throws IOException
This method is equivalent to read(bytes, 0, bytes.length).
This method will block until len bytes are available to copy into the
array, or will throw EOFException if the stream ends before the
array is full.
bytes - a byte array to fill with data from the streamIOException - If the underlying stream throws IOExceptionEOFException - If the stream has fewer bytes left than are needed to
fill the array, bytes.lengthpublic abstract void readFully(byte[] bytes,
int start,
int len)
throws IOException
len bytes of data into an array, at position start.
This method will block until len bytes are available to copy into the
array, or will throw EOFException if the stream ends before the
array is full.
bytes - a byte array to fill with data from the streamstart - the starting position in the byte array for datalen - the length of bytes to read into the byte arrayIOException - If the underlying stream throws IOExceptionEOFException - If the stream has fewer than len bytes leftpublic abstract int read(ByteBuffer buf) throws IOException
buf.remaining() bytes of data into a ByteBuffer.
This method will copy available bytes into the buffer, reading at most
buf.remaining() bytes. The number of bytes actually copied is
returned by the method, or -1 is returned to signal that the end of the
underlying stream has been reached.
buf - a byte buffer to fill with data from the streamIOException - If the underlying stream throws IOExceptionpublic abstract void readFully(ByteBuffer buf) throws IOException
buf.remaining() bytes of data into a ByteBuffer.
This method will block until buf.remaining() bytes are available
to copy into the buffer, or will throw EOFException if the stream
ends before the buffer is full.
buf - a byte buffer to fill with data from the streamIOException - If the underlying stream throws IOExceptionEOFException - If the stream has fewer bytes left than are needed to
fill the buffer, buf.remaining()public void readVectored(List<ParquetFileRange> ranges, ByteBufferAllocator allocator) throws IOException
ranges - a list of non-overlapping file ranges to readallocator - the allocator to use for allocating ByteBuffersUnsupportedOperationException - if not available in this class/runtime (default)EOFException - if a range is past the known end of the file.IOException - any IO problem initiating the read operations.IllegalArgumentException - if there are overlapping ranges or
a range element is invalidpublic boolean readVectoredAvailable(ByteBufferAllocator allocator)
readVectored(List, ByteBufferAllocator) method available?allocator - the allocator to use for allocating ByteBuffersCopyright © 2023 The Apache Software Foundation. All rights reserved.