public class BufferUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static ByteBuffer |
EMPTY_BYTE_BUFFER |
static ByteBuffer[] |
EMPTY_BYTE_BUFFER_ARRAY |
| Constructor and Description |
|---|
BufferUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
get(ByteBuffer srcBuffer,
byte[] dstBytes,
int dstOffset,
int length) |
static void |
put(byte[] srcBytes,
int srcOffset,
int length,
ByteBuffer dstBuffer) |
static void |
put(ByteBuffer srcBuffer,
int srcOffset,
int length,
ByteBuffer dstBuffer) |
static void |
setPositionLimit(Buffer buffer,
int position,
int limit) |
static void |
setPositionLimit(ByteBuffer buffer,
int position,
int limit) |
static ByteBuffer |
slice(ByteBuffer chunk,
int size)
Slice
ByteBuffer of required size from big chunk. |
static ByteBuffer |
slice(ByteBuffer byteBuffer,
int position,
int limit)
Get the
ByteBuffer's slice basing on its passed position and limit. |
static String |
toStringContent(ByteBuffer byteBuffer,
Charset charset,
int position,
int limit) |
public static final ByteBuffer EMPTY_BYTE_BUFFER
public static final ByteBuffer[] EMPTY_BYTE_BUFFER_ARRAY
public static ByteBuffer slice(ByteBuffer chunk, int size)
ByteBuffer of required size from big chunk. Passed chunk position will be changed, after the slicing
(chunk.position += size).chunk - big ByteBuffer pool.size - required slice size.ByteBuffer of required size.public static ByteBuffer slice(ByteBuffer byteBuffer, int position, int limit)
ByteBuffer's slice basing on its passed position and limit. Position and limit values of the passed
ByteBuffer won't be changed. The result ByteBuffer position will be equal to 0, and limit equal to
number of sliced bytes (limit - position).byteBuffer - ByteBuffer to slice/position - the position in the passed byteBuffer, the slice will start from.limit - the limit in the passed byteBuffer, the slice will be ended.ByteBuffer of required size.public static String toStringContent(ByteBuffer byteBuffer, Charset charset, int position, int limit)
public static void setPositionLimit(ByteBuffer buffer, int position, int limit)
public static void setPositionLimit(Buffer buffer, int position, int limit)
public static void put(ByteBuffer srcBuffer, int srcOffset, int length, ByteBuffer dstBuffer)
public static void get(ByteBuffer srcBuffer, byte[] dstBytes, int dstOffset, int length)
public static void put(byte[] srcBytes,
int srcOffset,
int length,
ByteBuffer dstBuffer)
Copyright © 2017–2020 Eclipse Foundation. All rights reserved.