Package org.apache.iceberg.io
Interface RangeReadable
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
public interface RangeReadable extends java.io.CloseableRangeReadableis an interface that allows for implementations ofInputFilestreams to perform positional, range-based reads, which are more efficient than unbounded reads in many cloud provider object stores.Thread safety is not a requirement of the interface and is left to the implementation.
If the implementation is also a
SeekableInputStream, the position of the stream is not required to be updated based on the positional reads performed by this interface. Usage ofSeekableInputStreamshould always seek to the appropriate position forInputStreambased reads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidreadFully(long position, byte[] buffer)Fill the entire buffer with the contents of the input source starting atposition.voidreadFully(long position, byte[] buffer, int offset, int length)Fill the provided buffer with the contents of the input source starting atpositionfor the givenoffsetandlength.default intreadTail(byte[] buffer)Read the full size of the buffer from the end of the file.intreadTail(byte[] buffer, int offset, int length)Read the lastlengthbytes from the file.
-
-
-
Method Detail
-
readFully
void readFully(long position, byte[] buffer, int offset, int length) throws java.io.IOExceptionFill the provided buffer with the contents of the input source starting atpositionfor the givenoffsetandlength.- Parameters:
position- start position of the readbuffer- target buffer to copy dataoffset- offset in the buffer to copy the datalength- size of the read- Throws:
java.io.IOException
-
readFully
default void readFully(long position, byte[] buffer) throws java.io.IOExceptionFill the entire buffer with the contents of the input source starting atposition.- Parameters:
position- start position of the readbuffer- target buffer to copy data- Throws:
java.io.IOException
-
readTail
int readTail(byte[] buffer, int offset, int length) throws java.io.IOExceptionRead the lastlengthbytes from the file.- Parameters:
buffer- the buffer to write data intooffset- the offset in the buffer to start writinglength- the number of bytes from the end of the object to read- Returns:
- the actual number of bytes read
- Throws:
java.io.IOException- if an error occurs while reading
-
readTail
default int readTail(byte[] buffer) throws java.io.IOExceptionRead the full size of the buffer from the end of the file.- Parameters:
buffer- the buffer to write data into- Returns:
- the actual number of bytes read
- Throws:
java.io.IOException- if an error occurs while reading
-
-