public abstract class BuilderBase
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ALLOCATION_BOUNDARY |
protected int |
allocationSize |
static int |
DEFAULT_ASCII_ALLOCATION |
static int |
DEFAULT_OTHER_ALLOCATION |
protected java.nio.charset.Charset |
defaultCharset |
static byte[] |
NULL |
Modifier | Constructor and Description |
---|---|
protected |
BuilderBase(java.nio.charset.Charset defaultCharset,
int allocationSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
_setAllocationSize(int allocationSizeSuggestion) |
abstract int |
appendUnchecked(byte b)
Append a single byte without checking that the builder has the capacity
|
abstract int |
appendUnchecked(byte[] src)
Append the entire byte array without checking that the builder has the capacity
|
abstract int |
appendUnchecked(byte[] src,
int srcPos,
int len)
Append the entire byte array without checking that the builder has the capacity
|
static int |
bufferAllocSize(int atLeast,
int blockSize) |
abstract int |
capacity()
Get the number of bytes currently allocated (available) without resizing
|
abstract boolean |
equals(byte[] bytes)
Determine if a byte array contains the same bytes as this builder
|
int |
getAllocationSize()
Get the current allocation size
|
abstract byte[] |
internalArray()
Access the internal byte array of this buffer.
|
abstract int |
length()
Get the length of the data in the buffer
|
abstract byte[] |
toByteArray()
Copy the value in the buffer to a new byte array
|
protected final java.nio.charset.Charset defaultCharset
protected int allocationSize
public static final int ALLOCATION_BOUNDARY
public static final int DEFAULT_ASCII_ALLOCATION
public static final int DEFAULT_OTHER_ALLOCATION
public static final byte[] NULL
protected BuilderBase(java.nio.charset.Charset defaultCharset, int allocationSize)
protected void _setAllocationSize(int allocationSizeSuggestion)
public abstract int length()
public abstract int capacity()
public abstract boolean equals(byte[] bytes)
bytes
- the bytespublic abstract byte[] toByteArray()
public abstract byte[] internalArray()
length()
public abstract int appendUnchecked(byte b)
b
- the bytepublic abstract int appendUnchecked(byte[] src)
src
- the source byte arraypublic abstract int appendUnchecked(byte[] src, int srcPos, int len)
src
- the source byte arraysrcPos
- starting position in the source array.len
- the number of array elements to be copied.public int getAllocationSize()
public static int bufferAllocSize(int atLeast, int blockSize)