public abstract class BlockReader extends BlockClient
This class does not provide thread-safety.
BlockClient.Type
Constructor and Description |
---|
BlockReader()
Default constructor for the abstract reader implementations.
|
Modifier and Type | Method and Description |
---|---|
abstract ReadableByteChannel |
getChannel()
Returns a readable byte channel of the block.
|
abstract long |
getLength()
Gets the length of the block in bytes.
|
abstract boolean |
isClosed() |
abstract ByteBuffer |
read(long offset,
long length)
Reads data from the block.
|
abstract int |
transferTo(io.netty.buffer.ByteBuf buf)
Transfers data (up to buf.writableBytes()) from this reader to the buffer.
|
close, toString
public BlockReader()
public abstract ByteBuffer read(long offset, long length) throws IOException
offset
- the offset from starting of the block file in byteslength
- the length of data to read in bytes, -1 for the rest of the blockByteBuffer
the data that was readIOException
public abstract long getLength()
public abstract ReadableByteChannel getChannel()
public abstract int transferTo(io.netty.buffer.ByteBuf buf) throws IOException
buf
- the byte bufferIOException
public abstract boolean isClosed()
Copyright © 2023. All Rights Reserved.