public class HeaderlessChannelReaderInputView extends ChannelReaderInputView
DataInputView that is backed by a BlockChannelReader, making it effectively a data input
stream. This view is similar to the ChannelReaderInputView, but does not expect
a header for each block, giving a direct stream abstraction over sequence of written
blocks. It therefore requires specification of the number of blocks and the number of
bytes in the last block.numRequestsRemaining, readerheaderLength| Constructor and Description |
|---|
HeaderlessChannelReaderInputView(BlockChannelReader reader,
List<MemorySegment> memory,
int numBlocks,
int numBytesInLastBlock,
boolean waitForFirstBlock)
Creates a new channel reader that reads from the given channel, expecting a specified
number of blocks in the channel, and returns only a specified number of bytes from
the last block.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
getLimitForSegment(MemorySegment segment)
Gets the limit for reading bytes from the given memory segment.
|
protected MemorySegment |
nextSegment(MemorySegment current)
Gets the next segment from the asynchronous block reader.
|
close, isClosed, sendReadRequest, waitForFirstBlockadvance, clear, getCurrentPositionInSegment, getCurrentSegment, getCurrentSegmentLimit, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seekInput, skipBytes, skipBytesToReadpublic HeaderlessChannelReaderInputView(BlockChannelReader reader, List<MemorySegment> memory, int numBlocks, int numBytesInLastBlock, boolean waitForFirstBlock) throws IOException
WARNING: If the number of blocks given here is higher than the number of blocks in the channel, then the last blocks will not be filled by the reader and will contain undefined data.
reader - The reader that reads the data from disk back into memory.memory - A list of memory segments that the reader uses for reading the data in. If the
list contains more than one segment, the reader will asynchronously pre-fetch
blocks ahead.numBlocks - The number of blocks this channel will read.numBytesInLastBlock - The number of valid bytes in the last block.waitForFirstBlock - A flag indicating weather this constructor call should block
until the first block has returned from the asynchronous I/O reader.IOException - Thrown, if the read requests for the first blocks fail to be
served by the reader.protected MemorySegment nextSegment(MemorySegment current) throws IOException
ChannelReaderInputViewEOFException.nextSegment in class ChannelReaderInputViewcurrent - The memory segment used for the next request.EOFException - Thrown, if no further segments are available.IOException - Thrown, if an I/O error occurred while readingAbstractPagedInputView.nextSegment(org.apache.flink.core.memory.MemorySegment)protected int getLimitForSegment(MemorySegment segment)
AbstractPagedInputViewgetLimitForSegment in class ChannelReaderInputViewsegment - The segment to determine the limit for.Copyright © 2014 The Apache Software Foundation. All rights reserved.