public final class ByteBuffer extends Object
Modifier and Type | Field and Description |
---|---|
static int |
NO_GROWTH_INCREMENT |
Constructor and Description |
---|
ByteBuffer()
Creates the
ByteBuffer with allocated byte buffer. |
ByteBuffer(int length)
Creates the
ByteBuffer with allocated byte buffer. |
ByteBuffer(int length,
boolean useNIOBuffer) |
ByteBuffer(int length,
int growIncrement) |
ByteBuffer(int size,
int growIncrement,
boolean useNIOBuffer) |
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
add(byte b)
Adds byte to buffer.
|
ByteBuffer |
add(byte[] array)
Appends the array argument to internal buffer.
|
ByteBuffer |
add(byte[] array,
int start,
int len)
Appends the array argument to internal buffer.
|
ByteBuffer |
add(ByteBuffer buffer) |
ByteBuffer |
add(ByteBuffer buffer) |
ByteBuffer |
add(char b)
Adds char to buffer.
|
ByteBuffer |
add(String s) |
ByteBuffer |
addLikeString(long value) |
void |
checkAndExtend(int length) |
static ByteBuffer |
demand(int size) |
ByteBuffer |
flip() |
byte |
get() |
ByteBuffer |
get(byte[] dst) |
ByteBuffer |
get(byte[] dst,
int offset,
int length) |
byte |
get(int index) |
ByteBuffer |
getBuffer() |
byte[] |
getBulk() |
byte[] |
getByteArray()
Gets internal byte buffer.
|
byte[] |
getByteArray(int position,
int length)
Gets internal byte buffer.
|
char |
getChar() |
char |
getChar(int index) |
double |
getDouble() |
double |
getDouble(int index) |
int |
getInt() |
int |
getInt(int index) |
int |
getLength()
Gets buffer length.
|
long |
getLong() |
long |
getLong(int index) |
ByteBuffer |
getNioBuffer() |
int |
getOffset()
Gets buffer offset.
|
byte[] |
getSubArray(int start,
int length) |
void |
increaseBuffer(int increase)
Increases the buffer.
|
boolean |
isAvailable(int length)
Checks if buffer has a numOfBytes.
|
boolean |
isEmpty() |
int |
limit() |
ByteBuffer |
limit(int limit) |
int |
position() |
ByteBuffer |
position(int position) |
ByteBuffer |
put(byte b) |
ByteBuffer |
put(byte[] src) |
ByteBuffer |
put(byte[] src,
int offset,
int length) |
ByteBuffer |
put(int index,
byte b) |
ByteBuffer |
put(String s) |
ByteBuffer |
putChar(char value) |
ByteBuffer |
putChar(int index,
char value) |
ByteBuffer |
putDouble(double value) |
ByteBuffer |
putDouble(int index,
double value) |
ByteBuffer |
putInAll(int start,
int end,
byte value) |
ByteBuffer |
putInt(int value) |
ByteBuffer |
putInt(int index,
int value) |
ByteBuffer |
putLong(int index,
long value) |
ByteBuffer |
putLong(long value) |
void |
release() |
static void |
release(ByteBuffer buffer) |
int |
remaining() |
void |
resetBuffer()
Resets the buffer.
|
void |
setOffset(int offset)
Sets offset of buffer.
|
static ByteBuffer |
wrapBuffer(byte[] buffer) |
public static final int NO_GROWTH_INCREMENT
public ByteBuffer()
ByteBuffer
with allocated byte buffer.
The default buffer length if 1024 bytes.public ByteBuffer(int length)
ByteBuffer
with allocated byte buffer.length
- allocated buffer lengthpublic ByteBuffer(int length, boolean useNIOBuffer)
public ByteBuffer(int length, int growIncrement)
public ByteBuffer(int size, int growIncrement, boolean useNIOBuffer)
size
- buffer size in bytesgrowIncrement
- grow size in bytesuseNIOBuffer
- public ByteBuffer getBuffer()
public ByteBuffer addLikeString(long value)
public void checkAndExtend(int length)
public ByteBuffer add(String s)
public ByteBuffer put(String s)
public ByteBuffer add(byte[] array)
public ByteBuffer add(byte b)
b
- a bytepublic ByteBuffer add(char b)
b
- a charpublic ByteBuffer add(byte[] array, int start, int len)
public ByteBuffer add(ByteBuffer buffer)
public ByteBuffer add(ByteBuffer buffer)
public boolean isAvailable(int length)
length
- the requested spacepublic void setOffset(int offset)
offset
- the new offsetpublic void increaseBuffer(int increase)
increase
- the number of bytespublic byte[] getByteArray()
public byte[] getByteArray(int position, int length)
public void release()
public int limit()
public ByteBuffer limit(int limit)
public int position()
public ByteBuffer position(int position)
public ByteBuffer put(byte[] src)
public ByteBuffer put(byte b)
public byte get()
public byte get(int index)
public ByteBuffer put(int index, byte b)
public ByteBuffer put(byte[] src, int offset, int length)
public ByteBuffer get(byte[] dst)
public ByteBuffer get(byte[] dst, int offset, int length)
public ByteBuffer putChar(char value)
public ByteBuffer putChar(int index, char value)
public char getChar()
public char getChar(int index)
public ByteBuffer putInt(int value)
public ByteBuffer putInt(int index, int value)
public int getInt()
public int getInt(int index)
public ByteBuffer putLong(long value)
public ByteBuffer putLong(int index, long value)
public long getLong()
public long getLong(int index)
public ByteBuffer putDouble(double value)
public ByteBuffer putDouble(int index, double value)
public double getDouble()
public double getDouble(int index)
public ByteBuffer putInAll(int start, int end, byte value)
public int remaining()
public ByteBuffer flip()
public static ByteBuffer demand(int size)
public static void release(ByteBuffer buffer)
public ByteBuffer getNioBuffer()
public void resetBuffer()
public int getOffset()
public int getLength()
public byte[] getBulk()
public boolean isEmpty()
public static ByteBuffer wrapBuffer(byte[] buffer)
public byte[] getSubArray(int start, int length)
Copyright © 2000–2022 EPAM Systems. All rights reserved.