Class HeaderlessChannelReaderInputView

  • All Implemented Interfaces:
    DataInput, DataInputView

    public class HeaderlessChannelReaderInputView
    extends ChannelReaderInputView
    A 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.
    • Constructor Detail

      • HeaderlessChannelReaderInputView

        public HeaderlessChannelReaderInputView​(BlockChannelReader<MemorySegment> reader,
                                                List<MemorySegment> memory,
                                                int numBlocks,
                                                int numBytesInLastBlock,
                                                boolean waitForFirstBlock)
                                         throws IOException
        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.

        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.

        Parameters:
        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.
        Throws:
        IOException - Thrown, if the read requests for the first blocks fail to be served by the reader.