public interface BlockChannelReader<T> extends FileIOChannel
MemorySegment
. To support asynchronous implementations, the read
method does not immediately return the full memory segment, but rather adds it to a blocking
queue of finished read operations.FileIOChannel.Enumerator, FileIOChannel.ID
Modifier and Type | Method and Description |
---|---|
T |
getNextReturnedBlock()
Gets the next memory segment that has been filled with data by the reader.
|
LinkedBlockingQueue<T> |
getReturnQueue()
Gets the queue in which the full memory segments are queued after the read is complete.
|
void |
readBlock(T segment)
Issues a read request, which will fill the given segment with the next block in the
underlying file channel.
|
void |
seekToPosition(long position) |
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
void readBlock(T segment) throws IOException
segment
- The segment to read the block into.IOException
- Thrown, when the reader encounters an I/O error.void seekToPosition(long position) throws IOException
IOException
T getNextReturnedBlock() throws IOException
WARNING: If this method is invoked without any segment ever returning (for example,
because the readBlock(T)
method has not been invoked appropriately), the method may
block forever.
IOException
- Thrown, if an I/O error occurs in the reader while waiting for the
request to return.LinkedBlockingQueue<T> getReturnQueue()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.