public final class ByteBuffer extends Object
Constructor and Description |
---|
ByteBuffer(byte[] buf)
Create a new ByteBuffer from an existing array
|
ByteBuffer(byte[] buf,
int ofs,
int pos,
int siz)
Create a new ByteBuffer from an existing array
|
Modifier and Type | Method and Description |
---|---|
static ByteBuffer |
allocate(int size) |
static ByteBuffer |
allocateDirect(int size) |
byte[] |
array() |
int |
arrayOffset() |
ByteBuffer |
duplicate() |
void |
flip() |
byte |
get() |
void |
get(byte[] outBuf) |
void |
get(byte[] outBuf,
int outOffset,
int length) |
byte |
get(int position) |
char |
getChar() |
char |
getChar(int position) |
int |
getInt() |
long |
getLong() |
short |
getShort() |
boolean |
hasArray() |
boolean |
hasRemaining() |
boolean |
isDirect() |
int |
limit() |
ByteBuffer |
limit(int length) |
void |
mark() |
int |
position() |
void |
position(int position) |
void |
put(byte b) |
void |
put(byte[] data) |
void |
put(ByteBuffer data) |
void |
put(int index,
byte b) |
void |
putChar(char value) |
void |
putInt(int i) |
void |
putInt(int index,
int value) |
void |
putLong(long value) |
void |
putShort(short s) |
int |
remaining() |
void |
reset() |
void |
rewind() |
ByteBuffer |
slice() |
static ByteBuffer |
wrap(byte[] bytes) |
public ByteBuffer(byte[] buf)
buf
- the array backing this bufferpublic ByteBuffer(byte[] buf, int ofs, int pos, int siz)
buf
- the array backing this bufferofs
- offset to the first byte to usepos
- current buffer positionsiz
- total buffer sizepublic int position()
public void position(int position)
public byte get()
public int remaining()
public byte get(int position)
public static ByteBuffer allocate(int size)
public static ByteBuffer allocateDirect(int size)
public ByteBuffer slice()
public ByteBuffer limit(int length)
public void get(byte[] outBuf)
public void rewind()
public int limit()
public boolean hasArray()
public int arrayOffset()
public byte[] array()
public void flip()
public boolean isDirect()
public ByteBuffer duplicate()
public static ByteBuffer wrap(byte[] bytes)
public char getChar(int position)
public int getInt()
public long getLong()
public char getChar()
public short getShort()
public void put(int index, byte b)
public void put(byte b)
public void putInt(int i)
public void putShort(short s)
public void mark()
public void put(ByteBuffer data)
public void reset()
public void putInt(int index, int value)
public void putLong(long value)
public void putChar(char value)
public void put(byte[] data)
public void get(byte[] outBuf, int outOffset, int length)
public boolean hasRemaining()