public final class BufferUtils
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
BufferUtils()
No instances.
|
| Modifier and Type | Method and Description |
|---|---|
static java.nio.ByteBuffer |
ensureCapacity(java.nio.ByteBuffer buffer,
int capacity)
Ensure the byte buffer's capacity.
|
static java.nio.CharBuffer |
ensureCapacity(java.nio.CharBuffer buffer,
int capacity)
Ensure the char buffer's capacity.
|
(package private) static int |
sharedPrefixLength(java.nio.ByteBuffer a,
java.nio.ByteBuffer b)
Compute the length of the shared prefix between two byte sequences.
|
(package private) static int |
sharedPrefixLength(java.nio.ByteBuffer a,
int aStart,
java.nio.ByteBuffer b,
int bStart)
Compute the length of the shared prefix between two byte sequences.
|
static byte[] |
toArray(java.nio.ByteBuffer buffer) |
static java.lang.String |
toString(java.nio.ByteBuffer buffer,
java.nio.charset.Charset charset) |
public static java.nio.ByteBuffer ensureCapacity(java.nio.ByteBuffer buffer,
int capacity)
capacity - The required capacity of the buffer.buffer - The buffer to check or null if a new buffer should be
allocated.public static java.nio.CharBuffer ensureCapacity(java.nio.CharBuffer buffer,
int capacity)
capacity - The required capacity of the buffer.buffer - The buffer to check or null if a new buffer should be
allocated.public static java.lang.String toString(java.nio.ByteBuffer buffer,
java.nio.charset.Charset charset)
buffer - The buffer to convert to a string.charset - The charset to use when converting bytes to characters.public static byte[] toArray(java.nio.ByteBuffer buffer)
buffer - The buffer to read from.static int sharedPrefixLength(java.nio.ByteBuffer a,
int aStart,
java.nio.ByteBuffer b,
int bStart)
static int sharedPrefixLength(java.nio.ByteBuffer a,
java.nio.ByteBuffer b)