public final class BufferUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.nio.CharBuffer |
bytesToChars(java.nio.charset.CharsetDecoder decoder,
java.nio.ByteBuffer bytes,
java.nio.CharBuffer chars)
Convert byte buffer's content into characters.
|
static java.nio.ByteBuffer |
charsToBytes(java.nio.charset.CharsetEncoder encoder,
java.nio.CharBuffer chars,
java.nio.ByteBuffer bytes)
Convert chars into bytes.
|
static java.nio.ByteBuffer |
clearAndEnsureCapacity(java.nio.ByteBuffer buffer,
int elements)
Ensure the buffer's capacity is large enough to hold a given number
of elements.
|
static java.nio.CharBuffer |
clearAndEnsureCapacity(java.nio.CharBuffer buffer,
int elements)
Ensure the buffer's capacity is large enough to hold a given number
of elements.
|
static byte[] |
toArray(java.nio.ByteBuffer buffer) |
static java.lang.String |
toString(java.nio.ByteBuffer buffer,
java.nio.charset.Charset charset) |
static java.lang.String |
toString(java.nio.CharBuffer buffer) |
public static java.nio.ByteBuffer clearAndEnsureCapacity(java.nio.ByteBuffer buffer,
int elements)
elements - The required number of elements to be appended to the buffer.buffer - The buffer to check or null if a new buffer should be
allocated.public static java.nio.CharBuffer clearAndEnsureCapacity(java.nio.CharBuffer buffer,
int elements)
elements - The required number of elements to be appended to 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 java.lang.String toString(java.nio.CharBuffer buffer)
public static byte[] toArray(java.nio.ByteBuffer buffer)
buffer - The buffer to read from.public static java.nio.CharBuffer bytesToChars(java.nio.charset.CharsetDecoder decoder,
java.nio.ByteBuffer bytes,
java.nio.CharBuffer chars)
public static java.nio.ByteBuffer charsToBytes(java.nio.charset.CharsetEncoder encoder,
java.nio.CharBuffer chars,
java.nio.ByteBuffer bytes)
throws UnmappableInputException
UnmappableInputExceptionCopyright © 2018. All rights reserved.