@NotThreadSafe public class PagedBlockReader extends BlockReader
BlockClient.Type
Constructor and Description |
---|
PagedBlockReader(CacheManager cacheManager,
UfsManager ufsManager,
UfsInputStreamCache ufsInStreamCache,
AlluxioConfiguration conf,
long blockId,
Protocol.OpenUfsBlockOptions ufsBlockOptions)
Constructor for PagedBlockReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
ReadableByteChannel |
getChannel()
Returns a readable byte channel of the block.
|
long |
getLength()
Gets the length of the block in bytes.
|
String |
getLocation() |
boolean |
isClosed() |
ByteBuffer |
read(long offset,
long length)
Reads data from the block.
|
int |
transferTo(io.netty.buffer.ByteBuf buf)
Transfers data (up to buf.writableBytes()) from this reader to the buffer.
|
toString
public PagedBlockReader(CacheManager cacheManager, UfsManager ufsManager, UfsInputStreamCache ufsInStreamCache, AlluxioConfiguration conf, long blockId, Protocol.OpenUfsBlockOptions ufsBlockOptions)
cacheManager
- paging cache managerufsManager
- under file storage managerufsInStreamCache
- a cache for the in streams from ufsconf
- alluxio configurationsblockId
- block idufsBlockOptions
- options to open a ufs blockpublic ByteBuffer read(long offset, long length) throws IOException
BlockReader
read
in class BlockReader
offset
- the offset from starting of the block file in byteslength
- the length of data to read in bytesByteBuffer
the data that was readIOException
public long getLength()
BlockReader
getLength
in class BlockReader
public ReadableByteChannel getChannel()
BlockReader
getChannel
in class BlockReader
public int transferTo(io.netty.buffer.ByteBuf buf) throws IOException
BlockReader
transferTo
in class BlockReader
buf
- the byte bufferIOException
public boolean isClosed()
isClosed
in class BlockReader
public String getLocation()
getLocation
in class BlockReader
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class BlockClient
IOException
Copyright © 2023. All Rights Reserved.