@NotThreadSafe public final class ByteBufferKeyValuePartitionReader extends Object implements KeyValuePartitionReader
KeyValuePartitionReader
to access a key-value file using random
access API.KeyValuePartitionReader.Factory
Constructor and Description |
---|
ByteBufferKeyValuePartitionReader(ByteBuffer fileBytes)
Constructs
ByteBufferKeyValuePartitionReader . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
byte[] |
get(byte[] key)
Gets the value associated with the given key in the key-value partition, returning null if the
key is not found.
|
ByteBuffer |
get(ByteBuffer key)
Gets the value associated with the given key in the key-value partition, returning null if the
key is not found.
|
Index |
getIndex() |
PayloadReader |
getPayloadReader() |
KeyValueIterator |
iterator() |
int |
size() |
public ByteBufferKeyValuePartitionReader(ByteBuffer fileBytes)
ByteBufferKeyValuePartitionReader
.fileBytes
- the byte buffer as underline storage to read frompublic byte[] get(byte[] key) throws IOException
This could be slow when value size is large, use this cautiously or get(ByteBuffer)
which may avoid copying data.
get
in interface KeyValuePartitionReader
key
- key to get, cannot be nullIOException
public ByteBuffer get(ByteBuffer key) throws IOException
KeyValuePartitionReader
get
in interface KeyValuePartitionReader
key
- key to get, cannot be nullIOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public KeyValueIterator iterator()
iterator
in interface KeyValueIterable
KeyValueIterator
for iterating over key-value pairs in the storepublic int size() throws IOException, AlluxioException
size
in interface KeyValuePartitionReader
IOException
AlluxioException
public PayloadReader getPayloadReader()
PayloadReader
for reading payloads from the byte bufferCopyright © 2023. All Rights Reserved.