public final class BufferUtils
extends java.lang.Object
| 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.
|
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.Copyright © 2015. All rights reserved.