public final class IoBuffer extends Object
IoBuffer instances are *not* thread safe.
The IoBuffer uses a singly linked list to handle the multiple Buffers. Thus sequential access is very efficient and random access is not. It fits well with the common usage patterns of IoBuffer.
Modifier and Type | Method and Description |
---|---|
IoBuffer |
add(ByteBuffer... buffers)
Add one or more ByteBuffer to the current IoBuffer
|
static IoBuffer |
allocate(int capacity) |
static IoBuffer |
allocateDirect(int capacity) |
byte[] |
array() |
int |
arrayOffset() |
InputStream |
asInputStream()
Provides an input stream which is actually reading the
IoBuffer
instance. |
IoBuffer |
asReadOnlyBuffer() |
int |
capacity() |
IoBuffer |
clear() |
IoBuffer |
compact() |
IoBuffer |
duplicate()
Returns a copy of the current
IoBuffer , with an independent copy of the position, limit and mark. |
boolean |
equals(Object ob) |
IoBuffer |
extend(int size)
Extends the current IoBuffer capacity.
|
IoBuffer |
flip() |
byte |
get() |
IoBuffer |
get(byte[] dst) |
IoBuffer |
get(byte[] dst,
int offset,
int length) |
byte |
get(int index) |
char |
getChar() |
char |
getChar(int index) |
double |
getDouble() |
double |
getDouble(int index) |
float |
getFloat() |
float |
getFloat(int index) |
int |
getInt() |
int |
getInt(int index) |
long |
getLong() |
long |
getLong(int index) |
short |
getShort() |
long |
getShort(int index) |
int |
hashCode() |
boolean |
hasRemaining() |
boolean |
isDirect() |
boolean |
isReadOnly() |
int |
limit() |
void |
limit(int newLimit) |
void |
mark() |
static IoBuffer |
newInstance()
Build a new instance of
IoBuffer |
ByteOrder |
order()
Returns the byte order used by this IoBuffer when converting bytes from/to other primitive
types.
|
IoBuffer |
order(ByteOrder bo)
Sets the byte order of this IoBuffer.
|
int |
position() |
void |
position(int newPosition) |
IoBuffer |
put(byte b) |
IoBuffer |
put(byte[] src) |
IoBuffer |
put(byte[] src,
int offset,
int length) |
IoBuffer |
put(ByteBuffer src) |
IoBuffer |
put(int index,
byte value) |
IoBuffer |
put(IoBuffer src) |
IoBuffer |
putChar(char value) |
IoBuffer |
putChar(int index,
char value) |
IoBuffer |
putDouble(double value) |
IoBuffer |
putDouble(int index,
double value) |
IoBuffer |
putFloat(float value) |
IoBuffer |
putFloat(int index,
float value) |
IoBuffer |
putInt(int value) |
IoBuffer |
putInt(int index,
int value) |
IoBuffer |
putLong(int index,
long value) |
IoBuffer |
putLong(long value) |
IoBuffer |
putShort(int index,
short value) |
IoBuffer |
putShort(short value) |
int |
remaining() |
IoBuffer |
reset() |
IoBuffer |
rewind() |
IoBuffer |
slice() |
String |
toString() |
static IoBuffer |
wrap(byte[]... arrays) |
static IoBuffer |
wrap(byte[] array,
int offset,
int length) |
static IoBuffer |
wrap(ByteBuffer... buffers)
Wraps ByteBuffers into a new IoBuffer
|
public static IoBuffer allocate(int capacity)
ByteBuffer.allocate(int)
public static IoBuffer allocateDirect(int capacity)
ByteBuffer.allocateDirect(int)
public static IoBuffer newInstance()
IoBuffer
IoBuffer
public static IoBuffer wrap(byte[]... arrays)
ByteBuffer.wrap(byte[])
public static IoBuffer wrap(byte[] array, int offset, int length)
ByteBuffer.wrap(byte[], int, int)
public static IoBuffer wrap(ByteBuffer... buffers)
buffers
- the ByteBuffers to wrapIoBuffer
public IoBuffer add(ByteBuffer... buffers)
buffers
- the ByteBuffers to addIoBuffer
public byte[] array()
ByteBuffer.array()
public int arrayOffset()
ByteBuffer.arrayOffset()
public InputStream asInputStream()
IoBuffer
instance.
Further reads on the returned InputStream move the reading head of the IoBuffer
instance used for it's creation
public IoBuffer asReadOnlyBuffer()
ByteBuffer.asReadOnlyBuffer()
public int capacity()
Buffer.capacity()
public IoBuffer clear()
Buffer.clear()
public IoBuffer compact()
ByteBuffer.compact()
public IoBuffer duplicate()
IoBuffer
, with an independent copy of the position, limit and mark.IoBuffer
public IoBuffer extend(int size)
size
- the number of bytes to extend the current IoBufferIoBuffer
public IoBuffer flip()
Buffer.flip()
public byte get()
ByteBuffer.get()
public IoBuffer get(byte[] dst)
ByteBuffer.get(byte[])
public IoBuffer get(byte[] dst, int offset, int length)
ByteBuffer.get(byte[], int,int)
public byte get(int index)
ByteBuffer.get(int)
public char getChar()
ByteBuffer.getChar()
public char getChar(int index)
ByteBuffer.getChar(int)
public double getDouble()
ByteBuffer.getDouble()
public double getDouble(int index)
ByteBuffer.getDouble(int)
public float getFloat()
ByteBuffer.getFloat()
public float getFloat(int index)
ByteBuffer.getFloat(int)
public int getInt()
ByteBuffer.getInt()
public int getInt(int index)
ByteBuffer.getInt(int)
public long getLong()
ByteBuffer.getLong()
public long getLong(int index)
ByteBuffer.getLong(int)
public short getShort()
ByteBuffer.getShort()
public long getShort(int index)
ByteBuffer.getShort(int)
public boolean hasRemaining()
Buffer.hasRemaining()
public boolean isDirect()
ByteBuffer.isDirect()
public boolean isReadOnly()
Buffer.isReadOnly()
public int limit()
Buffer.limit()
public void limit(int newLimit)
Buffer.limit(int)
public void mark()
Buffer.mark()
public ByteOrder order()
The default byte order of byte buffer is always BIG_ENDIAN
ByteBuffer.order()
public IoBuffer order(ByteOrder bo)
bo
- the byte order to set. If null
then the order will be LITTLE_ENDIAN
.ByteBuffer.order(ByteOrder)
public int position()
Buffer.position()
public void position(int newPosition)
Buffer.position(int)
public IoBuffer put(byte b)
ByteBuffer.put(byte)
public IoBuffer put(byte[] src)
ByteBuffer.put(byte[])
public IoBuffer put(ByteBuffer src)
ByteBuffer.put(ByteBuffer)
public IoBuffer put(IoBuffer src)
ByteBuffer.put(ByteBuffer)
public IoBuffer put(byte[] src, int offset, int length)
ByteBuffer.put(byte[], int, int)
public IoBuffer put(int index, byte value)
ByteBuffer.put(int, byte)
public IoBuffer putChar(char value)
ByteBuffer.putChar(char)
public IoBuffer putChar(int index, char value)
ByteBuffer.putChar(int, char)
public IoBuffer putDouble(double value)
ByteBuffer.putDouble(double)
public IoBuffer putDouble(int index, double value)
ByteBuffer.putDouble(int, double)
public IoBuffer putFloat(float value)
ByteBuffer.putFloat(float)
public IoBuffer putFloat(int index, float value)
ByteBuffer.putFloat(int, float)
public IoBuffer putInt(int value)
ByteBuffer.putInt(int)
public IoBuffer putInt(int index, int value)
ByteBuffer.putInt(int, int)
public IoBuffer putLong(int index, long value)
ByteBuffer.putLong(int, long)
public IoBuffer putLong(long value)
ByteBuffer.putLong(long)
public IoBuffer putShort(int index, short value)
ByteBuffer.putShort(int, short)
public IoBuffer putShort(short value)
ByteBuffer.putShort(short)
public int remaining()
Buffer.remaining()
public IoBuffer reset()
Buffer.reset()
public IoBuffer rewind()
Buffer.rewind()
public IoBuffer slice()
ByteBuffer.slice()
Copyright © 2009–2013 Apache MINA Project. All rights reserved.