|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.epam.common.utils.ByteBuffer
public final class ByteBuffer
The byte buffer helper class.
Field Summary | |
---|---|
static int |
NO_GROWTH_INCREMENT
|
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
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(char b)
Adds char to buffer. |
ByteBuffer |
add(long value)
|
ByteBuffer |
add(String s)
|
static int |
formatInt(long value,
byte[] buffer,
int offset)
|
static int |
formatIntLength(long value)
|
byte[] |
getBulk()
|
byte[] |
getByteArray()
Gets internal byte buffer. |
int |
getLength()
Gets buffer length. |
ByteBuffer |
getNioBuffer()
|
int |
getOffset()
Gets buffer offset. |
byte[] |
getSubArray(int start,
int length)
|
ByteBuffer |
getSubBuffer(int start,
int length)
|
void |
increaseBuffer(int incNumOfBytes)
Increases the buffer. |
boolean |
isAvailable(int numOfBytes)
Checks if buffer has a numOfBytes. |
boolean |
isEmpty()
|
void |
resetBuffer()
Resets the buffer. |
void |
setOffset(int offset)
Sets offset of buffer. |
static ByteBuffer |
wrapBuffer(byte[] buffer)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_GROWTH_INCREMENT
Constructor Detail |
---|
public ByteBuffer()
ByteBuffer
with allocated byte buffer.
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
- Method Detail |
---|
public ByteBuffer getNioBuffer()
public void resetBuffer()
public ByteBuffer add(byte[] array)
public static int formatIntLength(long value)
public static int formatInt(long value, byte[] buffer, int offset)
public ByteBuffer add(long value)
public ByteBuffer add(String s)
public ByteBuffer add(byte[] array, int start, int len)
public void increaseBuffer(int incNumOfBytes)
incNumOfBytes
- the number of bytespublic void setOffset(int offset)
offset
- the new offsetpublic int getOffset()
public ByteBuffer add(byte b)
b
- a bytepublic ByteBuffer add(char b)
b
- a charpublic byte[] getByteArray()
public int getLength()
public boolean isAvailable(int numOfBytes)
numOfBytes
- the requested space
public byte[] getBulk()
public boolean isEmpty()
public static ByteBuffer wrapBuffer(byte[] buffer)
public ByteBuffer getSubBuffer(int start, int length)
public byte[] getSubArray(int start, int length)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |