public class CompressedHeaderlessChannelReaderInputView extends AbstractChannelReaderInputView implements RequestDoneCallback<Buffer>, BufferRecycler
DataInputView
that is backed by a BufferFileReader
, making it effectively a data input stream. The view reads it data in blocks
from the underlying channel and decompress it before returning to caller. The view can only read
data that has been written by CompressedHeaderlessChannelWriterOutputView
, due to block
formatting.BufferRecycler.DummyBufferRecycler
headerLength
Constructor and Description |
---|
CompressedHeaderlessChannelReaderInputView(FileIOChannel.ID id,
IOManager ioManager,
BlockCompressionFactory compressionCodecFactory,
int compressionBlockSize,
int numBlocks) |
Modifier and Type | Method and Description |
---|---|
List<MemorySegment> |
close()
Closes this InputView, closing the underlying reader and returning all memory segments.
|
FileIOChannel |
getChannel()
Get the underlying channel.
|
protected int |
getLimitForSegment(MemorySegment segment)
Gets the limit for reading bytes from the given memory segment.
|
BufferFileReader |
getReader() |
boolean |
isClosed() |
protected MemorySegment |
nextSegment(MemorySegment current)
The method by which concrete subclasses realize page crossing.
|
void |
recycle(MemorySegment segment)
Recycles the
MemorySegment to its original BufferPool instance. |
void |
requestFailed(Buffer buffer,
IOException e) |
void |
requestSuccessful(Buffer request) |
advance, clear, doAdvance, getCurrentPositionInSegment, getCurrentSegment, getCurrentSegmentLimit, getHeaderLength, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seekInput, skipBytes, skipBytesToRead
public CompressedHeaderlessChannelReaderInputView(FileIOChannel.ID id, IOManager ioManager, BlockCompressionFactory compressionCodecFactory, int compressionBlockSize, int numBlocks) throws IOException
IOException
protected MemorySegment nextSegment(MemorySegment current) throws IOException
AbstractPagedInputView
EOFException
.nextSegment
in class AbstractPagedInputView
current
- The current page that was read to its limit. May be null
, if this
method is invoked for the first time.null
. If the
input is exhausted, an EOFException
must be thrown instead.EOFException
- Thrown, if no further segment is available.IOException
- Thrown, if the method cannot provide the next page due to an I/O related
problem.public BufferFileReader getReader()
protected int getLimitForSegment(MemorySegment segment)
AbstractPagedInputView
getLimitForSegment
in class AbstractPagedInputView
segment
- The segment to determine the limit for.public List<MemorySegment> close() throws IOException
AbstractChannelReaderInputView
close
in class AbstractChannelReaderInputView
IOException
- Thrown, if the underlying reader could not be properly closed.public FileIOChannel getChannel()
AbstractChannelReaderInputView
getChannel
in class AbstractChannelReaderInputView
public boolean isClosed()
public void requestSuccessful(Buffer request)
requestSuccessful
in interface RequestDoneCallback<Buffer>
public void requestFailed(Buffer buffer, IOException e)
requestFailed
in interface RequestDoneCallback<Buffer>
public void recycle(MemorySegment segment)
BufferRecycler
MemorySegment
to its original BufferPool
instance.recycle
in interface BufferRecycler
segment
- The memory segment to be recycled.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.