|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mina.common.ByteBuffer org.apache.mina.common.ByteBufferProxy
public class ByteBufferProxy
A ByteBuffer
that wraps a buffer and proxies any operations to it.
You can think this class like a FilterOutputStream
. All operations
are proxied by default so that you can extend this class and override existing
operations selectively. You can introduce new operations, too.
Field Summary | |
---|---|
protected ByteBuffer |
buf
The buffer proxied by this proxy. |
Constructor Summary | |
---|---|
protected |
ByteBufferProxy(ByteBuffer buf)
Create a new instance. |
Method Summary | |
---|---|
void |
acquire()
Increases the internal reference count of this buffer to defer automatic release. |
CharBuffer |
asCharBuffer()
|
DoubleBuffer |
asDoubleBuffer()
|
FloatBuffer |
asFloatBuffer()
|
IntBuffer |
asIntBuffer()
|
LongBuffer |
asLongBuffer()
|
ShortBuffer |
asShortBuffer()
|
ByteBuffer |
buf()
Returns the underlying NIO buffer instance. |
int |
capacity()
|
ByteBuffer |
clear()
|
ByteBuffer |
compact()
|
int |
compareTo(ByteBuffer that)
|
boolean |
equals(Object ob)
|
ByteBuffer |
fill(byte value,
int size)
Fills this buffer with the specified value. |
ByteBuffer |
fill(int size)
Fills this buffer with NUL (0x00) . |
ByteBuffer |
fillAndReset(byte value,
int size)
Fills this buffer with the specified value. |
ByteBuffer |
fillAndReset(int size)
Fills this buffer with NUL (0x00) . |
ByteBuffer |
flip()
|
byte |
get()
|
ByteBuffer |
get(byte[] dst)
|
ByteBuffer |
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)
|
String |
getHexDump()
Returns hexdump of this buffer. |
int |
getInt()
|
int |
getInt(int index)
|
long |
getLong()
|
long |
getLong(int index)
|
short |
getShort()
|
short |
getShort(int index)
|
String |
getString(CharsetDecoder decoder)
Reads a NUL -terminated string from this buffer using the
specified decoder and returns it. |
String |
getString(int fieldSize,
CharsetDecoder decoder)
Reads a NUL -terminated string from this buffer using the
specified decoder and returns it. |
short |
getUnsigned()
|
short |
getUnsigned(int index)
|
long |
getUnsignedInt()
|
long |
getUnsignedInt(int index)
|
int |
getUnsignedShort()
|
int |
getUnsignedShort(int index)
|
int |
hashCode()
|
boolean |
hasRemaining()
|
boolean |
isAutoExpand()
Returns true if and only if autoExpand is turned on. |
boolean |
isDirect()
|
int |
limit()
|
ByteBuffer |
limit(int newLimit)
|
ByteBuffer |
mark()
|
ByteOrder |
order()
|
ByteBuffer |
order(ByteOrder bo)
|
int |
position()
|
ByteBuffer |
position(int newPosition)
|
ByteBuffer |
put(byte b)
|
ByteBuffer |
put(byte[] src)
|
ByteBuffer |
put(byte[] src,
int offset,
int length)
|
ByteBuffer |
put(ByteBuffer src)
|
ByteBuffer |
put(ByteBuffer src)
|
ByteBuffer |
put(int index,
byte b)
|
ByteBuffer |
putChar(char value)
|
ByteBuffer |
putChar(int index,
char value)
|
ByteBuffer |
putDouble(double value)
|
ByteBuffer |
putDouble(int index,
double value)
|
ByteBuffer |
putFloat(float value)
|
ByteBuffer |
putFloat(int index,
float value)
|
ByteBuffer |
putInt(int value)
|
ByteBuffer |
putInt(int index,
int value)
|
ByteBuffer |
putLong(int index,
long value)
|
ByteBuffer |
putLong(long value)
|
ByteBuffer |
putShort(int index,
short value)
|
ByteBuffer |
putShort(short value)
|
ByteBuffer |
putString(CharSequence in,
CharsetEncoder encoder)
Writes the content of in into this buffer using the
specified encoder . |
ByteBuffer |
putString(CharSequence in,
int fieldSize,
CharsetEncoder encoder)
Writes the content of in into this buffer as a
NUL -terminated string using the specified
encoder . |
void |
release()
Releases the specified buffer to buffer pool. |
int |
remaining()
|
ByteBuffer |
reset()
|
ByteBuffer |
rewind()
|
ByteBuffer |
setAutoExpand(boolean autoExpand)
Turns on or off autoExpand. |
ByteBuffer |
skip(int size)
Forwards the position of this buffer as the specified size
bytes. |
String |
toString()
|
Methods inherited from class org.apache.mina.common.ByteBuffer |
---|
allocate, allocate, wrap, wrap, wrap |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ByteBuffer buf
Constructor Detail |
---|
protected ByteBufferProxy(ByteBuffer buf)
buf
- the buffer to be proxiedMethod Detail |
---|
public void acquire()
ByteBuffer
ByteBuffer.release()
as many
as you invoked this method to release this buffer.
acquire
in class ByteBuffer
public void release()
ByteBuffer
release
in class ByteBuffer
public boolean isDirect()
isDirect
in class ByteBuffer
public ByteBuffer buf()
ByteBuffer
buf
in class ByteBuffer
public int capacity()
capacity
in class ByteBuffer
public int position()
position
in class ByteBuffer
public ByteBuffer position(int newPosition)
position
in class ByteBuffer
public int limit()
limit
in class ByteBuffer
public ByteBuffer limit(int newLimit)
limit
in class ByteBuffer
public ByteBuffer mark()
mark
in class ByteBuffer
public ByteBuffer reset()
reset
in class ByteBuffer
public ByteBuffer clear()
clear
in class ByteBuffer
public ByteBuffer flip()
flip
in class ByteBuffer
public ByteBuffer rewind()
rewind
in class ByteBuffer
public int remaining()
remaining
in class ByteBuffer
public boolean hasRemaining()
hasRemaining
in class ByteBuffer
public byte get()
get
in class ByteBuffer
public short getUnsigned()
getUnsigned
in class ByteBuffer
public ByteBuffer put(byte b)
put
in class ByteBuffer
public byte get(int index)
get
in class ByteBuffer
public short getUnsigned(int index)
getUnsigned
in class ByteBuffer
public ByteBuffer put(int index, byte b)
put
in class ByteBuffer
public ByteBuffer get(byte[] dst, int offset, int length)
get
in class ByteBuffer
public ByteBuffer get(byte[] dst)
get
in class ByteBuffer
public ByteBuffer put(ByteBuffer src)
put
in class ByteBuffer
public ByteBuffer put(ByteBuffer src)
put
in class ByteBuffer
public ByteBuffer put(byte[] src, int offset, int length)
put
in class ByteBuffer
public ByteBuffer put(byte[] src)
put
in class ByteBuffer
public ByteBuffer compact()
compact
in class ByteBuffer
public String toString()
toString
in class ByteBuffer
public int hashCode()
hashCode
in class ByteBuffer
public boolean equals(Object ob)
equals
in class ByteBuffer
public int compareTo(ByteBuffer that)
compareTo
in class ByteBuffer
public ByteOrder order()
order
in class ByteBuffer
public ByteBuffer order(ByteOrder bo)
order
in class ByteBuffer
public char getChar()
getChar
in class ByteBuffer
public ByteBuffer putChar(char value)
putChar
in class ByteBuffer
public char getChar(int index)
getChar
in class ByteBuffer
public ByteBuffer putChar(int index, char value)
putChar
in class ByteBuffer
public CharBuffer asCharBuffer()
asCharBuffer
in class ByteBuffer
public short getShort()
getShort
in class ByteBuffer
public int getUnsignedShort()
getUnsignedShort
in class ByteBuffer
public ByteBuffer putShort(short value)
putShort
in class ByteBuffer
public short getShort(int index)
getShort
in class ByteBuffer
public int getUnsignedShort(int index)
getUnsignedShort
in class ByteBuffer
public ByteBuffer putShort(int index, short value)
putShort
in class ByteBuffer
public ShortBuffer asShortBuffer()
asShortBuffer
in class ByteBuffer
public int getInt()
getInt
in class ByteBuffer
public long getUnsignedInt()
getUnsignedInt
in class ByteBuffer
public ByteBuffer putInt(int value)
putInt
in class ByteBuffer
public int getInt(int index)
getInt
in class ByteBuffer
public long getUnsignedInt(int index)
getUnsignedInt
in class ByteBuffer
public ByteBuffer putInt(int index, int value)
putInt
in class ByteBuffer
public IntBuffer asIntBuffer()
asIntBuffer
in class ByteBuffer
public long getLong()
getLong
in class ByteBuffer
public ByteBuffer putLong(long value)
putLong
in class ByteBuffer
public long getLong(int index)
getLong
in class ByteBuffer
public ByteBuffer putLong(int index, long value)
putLong
in class ByteBuffer
public LongBuffer asLongBuffer()
asLongBuffer
in class ByteBuffer
public float getFloat()
getFloat
in class ByteBuffer
public ByteBuffer putFloat(float value)
putFloat
in class ByteBuffer
public float getFloat(int index)
getFloat
in class ByteBuffer
public ByteBuffer putFloat(int index, float value)
putFloat
in class ByteBuffer
public FloatBuffer asFloatBuffer()
asFloatBuffer
in class ByteBuffer
public double getDouble()
getDouble
in class ByteBuffer
public ByteBuffer putDouble(double value)
putDouble
in class ByteBuffer
public double getDouble(int index)
getDouble
in class ByteBuffer
public ByteBuffer putDouble(int index, double value)
putDouble
in class ByteBuffer
public DoubleBuffer asDoubleBuffer()
asDoubleBuffer
in class ByteBuffer
public String getHexDump()
ByteBuffer
getHexDump
in class ByteBuffer
public String getString(int fieldSize, CharsetDecoder decoder) throws CharacterCodingException
ByteBuffer
NUL
-terminated string from this buffer using the
specified decoder
and returns it.
getString
in class ByteBuffer
fieldSize
- the maximum number of bytes to read
CharacterCodingException
public String getString(CharsetDecoder decoder) throws CharacterCodingException
ByteBuffer
NUL
-terminated string from this buffer using the
specified decoder
and returns it. This method reads
until the limit of this buffer if no NUL is found.
getString
in class ByteBuffer
CharacterCodingException
public ByteBuffer putString(CharSequence in, int fieldSize, CharsetEncoder encoder) throws CharacterCodingException
ByteBuffer
in
into this buffer as a
NUL
-terminated string using the specified
encoder
.
If the charset name of the encoder is UTF-16, you cannot specify
odd fieldSize
, and this method will append two
NUL
s as a terminator.
Please note that this method doesn't terminate with NUL
if the input string is longer than fieldSize.
putString
in class ByteBuffer
fieldSize
- the maximum number of bytes to write
CharacterCodingException
public ByteBuffer putString(CharSequence in, CharsetEncoder encoder) throws CharacterCodingException
ByteBuffer
in
into this buffer using the
specified encoder
. This method doesn't terminate
string with NUL. You have to do it by yourself.
putString
in class ByteBuffer
CharacterCodingException
public ByteBuffer skip(int size)
ByteBuffer
size
bytes.
skip
in class ByteBuffer
public ByteBuffer fill(byte value, int size)
ByteBuffer
fill
in class ByteBuffer
public ByteBuffer fillAndReset(byte value, int size)
ByteBuffer
fillAndReset
in class ByteBuffer
public ByteBuffer fill(int size)
ByteBuffer
NUL (0x00)
.
This method moves buffer position forward.
fill
in class ByteBuffer
public ByteBuffer fillAndReset(int size)
ByteBuffer
NUL (0x00)
.
This method does not change buffer position.
fillAndReset
in class ByteBuffer
public boolean isAutoExpand()
ByteBuffer
isAutoExpand
in class ByteBuffer
public ByteBuffer setAutoExpand(boolean autoExpand)
ByteBuffer
setAutoExpand
in class ByteBuffer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |