@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface PositionedReadable
Seekable.getPos()
visible.Modifier and Type | Method and Description |
---|---|
default int |
maxReadSizeForVectorReads()
What is the largest size that we should group ranges together as?
|
default int |
minSeekForVectorReads()
What is the smallest reasonable seek?
|
int |
read(long position,
byte[] buffer,
int offset,
int length)
Read up to the specified number of bytes, from a given
position within a file, and return the number of bytes read.
|
void |
readFully(long position,
byte[] buffer)
Read number of bytes equal to the length of the buffer, from a given
position within a file.
|
void |
readFully(long position,
byte[] buffer,
int offset,
int length)
Read the specified number of bytes, from a given
position within a file.
|
default void |
readVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges,
IntFunction<ByteBuffer> allocate)
Read fully a list of file ranges asynchronously from this file.
|
int read(long position, byte[] buffer, int offset, int length) throws IOException
position
- position within filebuffer
- destination bufferoffset
- offset in the bufferlength
- number of bytes to readIOException
- IO problems.void readFully(long position, byte[] buffer, int offset, int length) throws IOException
position
- position within filebuffer
- destination bufferoffset
- offset in the bufferlength
- number of bytes to readIOException
- IO problems.EOFException
- the end of the data was reached before
the read operation completedvoid readFully(long position, byte[] buffer) throws IOException
position
- position within filebuffer
- destination bufferIOException
- IO problems.EOFException
- the end of the data was reached before
the read operation completeddefault int minSeekForVectorReads()
default int maxReadSizeForVectorReads()
default void readVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate) throws IOException
The position returned by getPos() after readVectored() is undefined.
If a file is changed while the readVectored() operation is in progress, the output is undefined. Some ranges may have old data, some may have new and some may have both.
While a readVectored() operation is in progress, normal read api calls may block.
ranges
- the byte ranges to readallocate
- the function to allocate ByteBufferIOException
- any IOE.IllegalArgumentException
- if the any of ranges are invalid, or they overlap.Copyright © 2024 Apache Software Foundation. All rights reserved.