@InterfaceAudience.Private public class ByteBufferArray extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
| Constructor and Description |
|---|
ByteBufferArray(long capacity,
ByteBufferAllocator allocator)
We allocate a number of byte buffers as the capacity.
|
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer[] |
asSubByteBuffers(long offset,
int len)
Creates a sub-array from a given array of ByteBuffers from the given offset to the length
specified.
|
int |
read(long offset,
ByteBuff dst)
Transfers bytes from this buffers array into the given destination
ByteBuff |
int |
write(long offset,
ByteBuff src)
Transfers bytes from the given source
ByteBuff into this buffer array |
public static final int DEFAULT_BUFFER_SIZE
public ByteBufferArray(long capacity,
ByteBufferAllocator allocator)
throws IOException
capacity - total size of the byte buffer arrayallocator - the ByteBufferAllocator that will create the buffersIOException - throws IOException if there is an exception thrown by the allocatorpublic int read(long offset,
ByteBuff dst)
ByteBuffoffset - start position in this big logical array.dst - the destination ByteBuff. Notice that its position will be advanced.public int write(long offset,
ByteBuff src)
ByteBuff into this buffer arrayoffset - start offset of this big logical array.src - the source ByteBuff. Notice that its position will be advanced.public ByteBuffer[] asSubByteBuffers(long offset, int len)
offset - the position in the whole array which is composited by multiple byte buffers.len - the length of bytesCopyright © 2007–2022 The Apache Software Foundation. All rights reserved.