Class DelegatingSeekableInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
SeekableInputStream for generic input streams.
Implementations must implement getPos() and seek(long) and may optionally
implement other read methods to improve performance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()abstract longgetPos()Return the current position in the InputStream.intread()intread(byte[] b, int off, int len) intread(ByteBuffer buf) Readbuf.remaining()bytes of data into aByteBuffer.voidreadFully(byte[] bytes) Read a byte array of data, from position 0 to the end of the array.voidreadFully(byte[] bytes, int start, int len) Readlenbytes of data into an array, at positionstart.voidreadFully(ByteBuffer buf) Readbuf.remaining()bytes of data into aByteBuffer.abstract voidseek(long newPos) Seek to a new position in the InputStream.Methods inherited from class org.apache.parquet.io.SeekableInputStream
readVectored, readVectoredAvailableMethods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
Constructor Details
-
DelegatingSeekableInputStream
-
-
Method Details
-
getStream
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
getPos
Description copied from class:SeekableInputStreamReturn the current position in the InputStream.- Specified by:
getPosin classSeekableInputStream- Returns:
- current position in bytes from the start of the stream
- Throws:
IOException- If the underlying stream throws IOException
-
seek
Description copied from class:SeekableInputStreamSeek to a new position in the InputStream.- Specified by:
seekin classSeekableInputStream- Parameters:
newPos- the new position to seek to- Throws:
IOException- If the underlying stream throws IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
readFully
Description copied from class:SeekableInputStreamRead a byte array of data, from position 0 to the end of the array.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
EOFExceptionif the stream ends before the array is full.- Specified by:
readFullyin classSeekableInputStream- Parameters:
bytes- a byte array to fill with data from the stream- Throws:
IOException- If the underlying stream throws IOExceptionEOFException- If the stream has fewer bytes left than are needed to fill the array,bytes.length
-
readFully
Description copied from class:SeekableInputStreamReadlenbytes of data into an array, at positionstart.This method will block until len bytes are available to copy into the array, or will throw
EOFExceptionif the stream ends before the array is full.- Specified by:
readFullyin classSeekableInputStream- Parameters:
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 array- Throws:
IOException- If the underlying stream throws IOExceptionEOFException- If the stream has fewer thanlenbytes left
-
read
Description copied from class:SeekableInputStreamReadbuf.remaining()bytes of data into aByteBuffer.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.- Specified by:
readin classSeekableInputStream- Parameters:
buf- a byte buffer to fill with data from the stream- Returns:
- the number of bytes read or -1 if the stream ended
- Throws:
IOException- If the underlying stream throws IOException
-
readFully
Description copied from class:SeekableInputStreamReadbuf.remaining()bytes of data into aByteBuffer.This method will block until
buf.remaining()bytes are available to copy into the buffer, or will throwEOFExceptionif the stream ends before the buffer is full.- Specified by:
readFullyin classSeekableInputStream- Parameters:
buf- a byte buffer to fill with data from the stream- Throws:
IOException- If the underlying stream throws IOExceptionEOFException- If the stream has fewer bytes left than are needed to fill the buffer,buf.remaining()
-