public class BufferBuilder
extends java.lang.Object
StringBuilder.| Modifier and Type | Field and Description |
|---|---|
static int |
INITIAL_CAPACITY
Initial capacity for the internal buffer.
|
static int |
MAX_CAPACITY
Maximum capacity to which the array can grow.
|
| Constructor and Description |
|---|
BufferBuilder()
Construct a buffer builder with a default growth increment of
INITIAL_CAPACITY |
BufferBuilder(int initialCapacity)
Construct a buffer builder with an initial capacity that will be rounded up to the nearest power of 2.
|
| Modifier and Type | Method and Description |
|---|---|
BufferBuilder |
append(org.agrona.DirectBuffer srcBuffer,
int srcOffset,
int length)
Append a source buffer to the end of the internal buffer, resizing the internal buffer as required.
|
org.agrona.MutableDirectBuffer |
buffer()
The
MutableDirectBuffer that encapsulates the internal buffer. |
int |
capacity()
The current capacity of the buffer.
|
BufferBuilder |
compact()
Compact the buffer to reclaim unused space above the limit.
|
int |
limit()
The current limit of the buffer that has been used by append operations.
|
void |
limit(int limit)
Set this limit for this buffer as the position at which the next append operation will occur.
|
BufferBuilder |
reset()
Reset the builder to restart append operations.
|
public static final int MAX_CAPACITY
public static final int INITIAL_CAPACITY
public BufferBuilder()
INITIAL_CAPACITYpublic BufferBuilder(int initialCapacity)
initialCapacity - at which the capacity will start.public int capacity()
public int limit()
public void limit(int limit)
limit - to be the new value.public org.agrona.MutableDirectBuffer buffer()
MutableDirectBuffer that encapsulates the internal buffer.MutableDirectBuffer that encapsulates the internal buffer.public BufferBuilder reset()
public BufferBuilder compact()
public BufferBuilder append(org.agrona.DirectBuffer srcBuffer, int srcOffset, int length)
srcBuffer - from which to copy.srcOffset - in the source buffer from which to copy.length - in bytes to copy from the source buffer.Copyright © 2014-2017 Real Logic Ltd. All Rights Reserved.