|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.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. |
java.nio.CharBuffer |
asCharBuffer()
|
java.nio.DoubleBuffer |
asDoubleBuffer()
|
java.nio.FloatBuffer |
asFloatBuffer()
|
java.nio.IntBuffer |
asIntBuffer()
|
java.nio.LongBuffer |
asLongBuffer()
|
java.nio.ShortBuffer |
asShortBuffer()
|
java.nio.ByteBuffer |
buf()
Returns the underlying NIO buffer instance. |
int |
capacity()
|
ByteBuffer |
clear()
|
ByteBuffer |
compact()
|
int |
compareTo(ByteBuffer that)
|
boolean |
equals(java.lang.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)
|
java.lang.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)
|
java.lang.String |
getString(java.nio.charset.CharsetDecoder decoder)
Reads a NUL-terminated string from this buffer using the
specified decoder and returns it. |
java.lang.String |
getString(int fieldSize,
java.nio.charset.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()
|
boolean |
isPooled()
Returns true if and only if this buffer is returned back to the buffer pool when released. |
int |
limit()
|
ByteBuffer |
limit(int newLimit)
|
ByteBuffer |
mark()
|
java.nio.ByteOrder |
order()
|
ByteBuffer |
order(java.nio.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(java.nio.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(java.lang.CharSequence in,
java.nio.charset.CharsetEncoder encoder)
Writes the content of in into this buffer using the
specified encoder. |
ByteBuffer |
putString(java.lang.CharSequence in,
int fieldSize,
java.nio.charset.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. |
void |
setPooled(boolean pooled)
Sets whether this buffer is returned back to the buffer pool when released. |
ByteBuffer |
skip(int size)
Forwards the position of this buffer as the specified size
bytes. |
java.lang.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 proxied| Method Detail |
|---|
public void acquire()
ByteBufferByteBuffer.release() as many
as you invoked this method to release this buffer.
acquire in class ByteBufferpublic void release()
ByteBuffer
release in class ByteBufferpublic boolean isDirect()
isDirect in class ByteBufferpublic java.nio.ByteBuffer buf()
ByteBuffer
buf in class ByteBufferpublic int capacity()
capacity in class ByteBufferpublic int position()
position in class ByteBufferpublic ByteBuffer position(int newPosition)
position in class ByteBufferpublic int limit()
limit in class ByteBufferpublic ByteBuffer limit(int newLimit)
limit in class ByteBufferpublic ByteBuffer mark()
mark in class ByteBufferpublic ByteBuffer reset()
reset in class ByteBufferpublic ByteBuffer clear()
clear in class ByteBufferpublic ByteBuffer flip()
flip in class ByteBufferpublic ByteBuffer rewind()
rewind in class ByteBufferpublic int remaining()
remaining in class ByteBufferpublic boolean hasRemaining()
hasRemaining in class ByteBufferpublic byte get()
get in class ByteBufferpublic short getUnsigned()
getUnsigned in class ByteBufferpublic ByteBuffer put(byte b)
put in class ByteBufferpublic byte get(int index)
get in class ByteBufferpublic 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 ByteBufferpublic ByteBuffer get(byte[] dst)
get in class ByteBufferpublic ByteBuffer put(ByteBuffer src)
put in class ByteBufferpublic ByteBuffer put(java.nio.ByteBuffer src)
put in class ByteBuffer
public ByteBuffer put(byte[] src,
int offset,
int length)
put in class ByteBufferpublic ByteBuffer put(byte[] src)
put in class ByteBufferpublic ByteBuffer compact()
compact in class ByteBufferpublic java.lang.String toString()
toString in class ByteBufferpublic int hashCode()
hashCode in class ByteBufferpublic boolean equals(java.lang.Object ob)
equals in class ByteBufferpublic int compareTo(ByteBuffer that)
compareTo in class ByteBufferpublic java.nio.ByteOrder order()
order in class ByteBufferpublic ByteBuffer order(java.nio.ByteOrder bo)
order in class ByteBufferpublic char getChar()
getChar in class ByteBufferpublic ByteBuffer putChar(char value)
putChar in class ByteBufferpublic char getChar(int index)
getChar in class ByteBuffer
public ByteBuffer putChar(int index,
char value)
putChar in class ByteBufferpublic java.nio.CharBuffer asCharBuffer()
asCharBuffer in class ByteBufferpublic short getShort()
getShort in class ByteBufferpublic int getUnsignedShort()
getUnsignedShort in class ByteBufferpublic ByteBuffer putShort(short value)
putShort in class ByteBufferpublic short getShort(int index)
getShort in class ByteBufferpublic int getUnsignedShort(int index)
getUnsignedShort in class ByteBuffer
public ByteBuffer putShort(int index,
short value)
putShort in class ByteBufferpublic java.nio.ShortBuffer asShortBuffer()
asShortBuffer in class ByteBufferpublic int getInt()
getInt in class ByteBufferpublic long getUnsignedInt()
getUnsignedInt in class ByteBufferpublic ByteBuffer putInt(int value)
putInt in class ByteBufferpublic int getInt(int index)
getInt in class ByteBufferpublic long getUnsignedInt(int index)
getUnsignedInt in class ByteBuffer
public ByteBuffer putInt(int index,
int value)
putInt in class ByteBufferpublic java.nio.IntBuffer asIntBuffer()
asIntBuffer in class ByteBufferpublic long getLong()
getLong in class ByteBufferpublic ByteBuffer putLong(long value)
putLong in class ByteBufferpublic long getLong(int index)
getLong in class ByteBuffer
public ByteBuffer putLong(int index,
long value)
putLong in class ByteBufferpublic java.nio.LongBuffer asLongBuffer()
asLongBuffer in class ByteBufferpublic float getFloat()
getFloat in class ByteBufferpublic ByteBuffer putFloat(float value)
putFloat in class ByteBufferpublic float getFloat(int index)
getFloat in class ByteBuffer
public ByteBuffer putFloat(int index,
float value)
putFloat in class ByteBufferpublic java.nio.FloatBuffer asFloatBuffer()
asFloatBuffer in class ByteBufferpublic double getDouble()
getDouble in class ByteBufferpublic ByteBuffer putDouble(double value)
putDouble in class ByteBufferpublic double getDouble(int index)
getDouble in class ByteBuffer
public ByteBuffer putDouble(int index,
double value)
putDouble in class ByteBufferpublic java.nio.DoubleBuffer asDoubleBuffer()
asDoubleBuffer in class ByteBufferpublic java.lang.String getHexDump()
ByteBuffer
getHexDump in class ByteBuffer
public java.lang.String getString(int fieldSize,
java.nio.charset.CharsetDecoder decoder)
throws java.nio.charset.CharacterCodingException
ByteBufferNUL-terminated string from this buffer using the
specified decoder and returns it.
getString in class ByteBufferfieldSize - the maximum number of bytes to read
java.nio.charset.CharacterCodingException
public java.lang.String getString(java.nio.charset.CharsetDecoder decoder)
throws java.nio.charset.CharacterCodingException
ByteBufferNUL-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 ByteBufferjava.nio.charset.CharacterCodingException
public ByteBuffer putString(java.lang.CharSequence in,
int fieldSize,
java.nio.charset.CharsetEncoder encoder)
throws java.nio.charset.CharacterCodingException
ByteBufferin 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
NULs as a terminator.
Please note that this method doesn't terminate with NUL
if the input string is longer than fieldSize.
putString in class ByteBufferfieldSize - the maximum number of bytes to write
java.nio.charset.CharacterCodingException
public ByteBuffer putString(java.lang.CharSequence in,
java.nio.charset.CharsetEncoder encoder)
throws java.nio.charset.CharacterCodingException
ByteBufferin 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 ByteBufferjava.nio.charset.CharacterCodingExceptionpublic ByteBuffer skip(int size)
ByteBuffersize
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 ByteBufferpublic ByteBuffer fill(int size)
ByteBufferNUL (0x00).
This method moves buffer position forward.
fill in class ByteBufferpublic ByteBuffer fillAndReset(int size)
ByteBufferNUL (0x00).
This method does not change buffer position.
fillAndReset in class ByteBufferpublic boolean isAutoExpand()
ByteBuffer
isAutoExpand in class ByteBufferpublic ByteBuffer setAutoExpand(boolean autoExpand)
ByteBuffer
setAutoExpand in class ByteBufferpublic boolean isPooled()
ByteBuffer
The default value of this property is true if and only if you
allocated this buffer using ByteBuffer.allocate(int) or ByteBuffer.allocate(int, boolean),
or false otherwise. (i.e. ByteBuffer.wrap(byte[]), ByteBuffer.wrap(byte[], int, int),
and ByteBuffer.wrap(java.nio.ByteBuffer))
isPooled in class ByteBufferpublic void setPooled(boolean pooled)
ByteBuffer
The default value of this property is true if and only if you
allocated this buffer using ByteBuffer.allocate(int) or ByteBuffer.allocate(int, boolean),
or false otherwise. (i.e. ByteBuffer.wrap(byte[]), ByteBuffer.wrap(byte[], int, int),
and ByteBuffer.wrap(java.nio.ByteBuffer))
setPooled in class ByteBuffer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||