|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mina.core.buffer.IoBuffer
org.apache.mina.core.buffer.AbstractIoBuffer
public abstract class AbstractIoBuffer
A base implementation of IoBuffer. This implementation
assumes that IoBuffer.buf() always returns a correct NIO
ByteBuffer instance. Most implementations could
extend this class and implement their own buffer management mechanism.
IoBufferAllocator| Field Summary |
|---|
| Fields inherited from class org.apache.mina.core.buffer.IoBuffer |
|---|
EMPTY_BUFFER |
| Constructor Summary | |
|---|---|
protected |
AbstractIoBuffer(AbstractIoBuffer parent)
Creates a new derived buffer. |
protected |
AbstractIoBuffer(IoBufferAllocator allocator,
int initialCapacity)
Creates a new parent buffer. |
| Method Summary | ||
|---|---|---|
CharBuffer |
asCharBuffer()
|
|
DoubleBuffer |
asDoubleBuffer()
|
|
FloatBuffer |
asFloatBuffer()
|
|
InputStream |
asInputStream()
Returns an InputStream that reads the data from this buffer. |
|
IntBuffer |
asIntBuffer()
|
|
LongBuffer |
asLongBuffer()
|
|
OutputStream |
asOutputStream()
Returns an OutputStream that appends the data into this buffer. |
|
IoBuffer |
asReadOnlyBuffer()
|
|
protected abstract IoBuffer |
asReadOnlyBuffer0()
Implement this method to return the unexpandable read only version of this buffer. |
|
ShortBuffer |
asShortBuffer()
|
|
protected abstract void |
buf(ByteBuffer newBuf)
Sets the underlying NIO buffer instance. |
|
int |
capacity()
|
|
IoBuffer |
capacity(int newCapacity)
Increases the capacity of this buffer. |
|
IoBuffer |
clear()
|
|
IoBuffer |
compact()
|
|
int |
compareTo(IoBuffer that)
|
|
IoBuffer |
duplicate()
|
|
protected abstract IoBuffer |
duplicate0()
Implement this method to return the unexpandable duplicate of this buffer. |
|
boolean |
equals(Object o)
|
|
IoBuffer |
expand(int expectedRemaining)
Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the current position. |
|
IoBuffer |
expand(int pos,
int expectedRemaining)
Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the specified position. |
|
IoBuffer |
fill(byte value,
int size)
Fills this buffer with the specified value. |
|
IoBuffer |
fill(int size)
Fills this buffer with NUL (0x00). |
|
IoBuffer |
fillAndReset(byte value,
int size)
Fills this buffer with the specified value. |
|
IoBuffer |
fillAndReset(int size)
Fills this buffer with NUL (0x00). |
|
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)
|
|
|
getEnum(Class<E> enumClass)
Reads a byte from the buffer and returns the correlating enum constant defined by the specified enum type. |
|
|
getEnum(int index,
Class<E> enumClass)
Reads a byte from the buffer and returns the correlating enum constant defined by the specified enum type. |
|
|
getEnumInt(Class<E> enumClass)
Reads an int from the buffer and returns the correlating enum constant defined by the specified enum type. |
|
|
getEnumInt(int index,
Class<E> enumClass)
Reads an int from the buffer and returns the correlating enum constant defined by the specified enum type. |
|
|
getEnumSet(Class<E> enumClass)
Reads a byte sized bit vector and converts it to an EnumSet. |
|
|
getEnumSet(int index,
Class<E> enumClass)
Reads a byte sized bit vector and converts it to an EnumSet. |
|
|
getEnumSetInt(Class<E> enumClass)
Reads an int sized bit vector and converts it to an EnumSet. |
|
|
getEnumSetInt(int index,
Class<E> enumClass)
Reads an int sized bit vector and converts it to an EnumSet. |
|
|
getEnumSetLong(Class<E> enumClass)
Reads a long sized bit vector and converts it to an EnumSet. |
|
|
getEnumSetLong(int index,
Class<E> enumClass)
Reads a long sized bit vector and converts it to an EnumSet. |
|
|
getEnumSetShort(Class<E> enumClass)
Reads a short sized bit vector and converts it to an EnumSet. |
|
|
getEnumSetShort(int index,
Class<E> enumClass)
Reads a short sized bit vector and converts it to an EnumSet. |
|
|
getEnumShort(Class<E> enumClass)
Reads a short from the buffer and returns the correlating enum constant defined by the specified enum type. |
|
|
getEnumShort(int index,
Class<E> enumClass)
Reads a short from the buffer and returns the correlating enum constant defined by the specified enum type. |
|
float |
getFloat()
|
|
float |
getFloat(int index)
|
|
String |
getHexDump()
Returns hexdump of this buffer. |
|
String |
getHexDump(int lengthLimit)
Return hexdump of this buffer with limited length. |
|
int |
getInt()
|
|
int |
getInt(int index)
|
|
long |
getLong()
|
|
long |
getLong(int index)
|
|
int |
getMediumInt()
Relative get method for reading a medium int value. |
|
int |
getMediumInt(int index)
Absolute get method for reading a medium int value. |
|
Object |
getObject()
Reads a Java object from the buffer using the context ClassLoader
of the current thread. |
|
Object |
getObject(ClassLoader classLoader)
Reads a Java object from the buffer using the specified classLoader. |
|
String |
getPrefixedString(CharsetDecoder decoder)
Reads a string which has a 16-bit length field before the actual encoded string, using the specified decoder and returns it. |
|
String |
getPrefixedString(int prefixLength,
CharsetDecoder decoder)
Reads a string which has a length field before the actual encoded string, using the specified decoder and returns it. |
|
short |
getShort()
|
|
short |
getShort(int index)
|
|
IoBuffer |
getSlice(int length)
TODO document me. |
|
IoBuffer |
getSlice(int index,
int length)
TODO document me. |
|
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()
Reads one unsigned byte as a short integer. |
|
short |
getUnsigned(int index)
Reads one byte as an unsigned short integer. |
|
long |
getUnsignedInt()
Reads four bytes unsigned integer. |
|
long |
getUnsignedInt(int index)
Reads four bytes unsigned integer. |
|
int |
getUnsignedMediumInt()
Relative get method for reading an unsigned medium int value. |
|
int |
getUnsignedMediumInt(int index)
Absolute get method for reading an unsigned medium int value. |
|
int |
getUnsignedShort()
Reads two bytes unsigned integer. |
|
int |
getUnsignedShort(int index)
Reads two bytes unsigned integer. |
|
int |
hashCode()
|
|
boolean |
hasRemaining()
|
|
int |
indexOf(byte b)
Returns the first occurence position of the specified byte from the current position to the current limit. |
|
boolean |
isAutoExpand()
Returns true if and only if autoExpand is turned on. |
|
boolean |
isAutoShrink()
Returns true if and only if autoShrink is turned on. |
|
boolean |
isDerived()
returns true if and only if this buffer is derived from other buffer via IoBuffer.duplicate(), IoBuffer.slice() or IoBuffer.asReadOnlyBuffer(). |
|
boolean |
isDirect()
|
|
boolean |
isReadOnly()
|
|
int |
limit()
|
|
IoBuffer |
limit(int newLimit)
|
|
IoBuffer |
mark()
|
|
int |
markValue()
Returns the position of the current mark. |
|
int |
minimumCapacity()
Returns the minimum capacity of this buffer which is used to determine the new capacity of the buffer shrunk by IoBuffer.compact() and
IoBuffer.shrink() operation. |
|
IoBuffer |
minimumCapacity(int minimumCapacity)
Sets the minimum capacity of this buffer which is used to determine the new capacity of the buffer shrunk by IoBuffer.compact() and
IoBuffer.shrink() operation. |
|
ByteOrder |
order()
|
|
IoBuffer |
order(ByteOrder bo)
|
|
int |
position()
|
|
IoBuffer |
position(int newPosition)
|
|
boolean |
prefixedDataAvailable(int prefixLength)
Returns true if this buffer contains a data which has a data length as a prefix and the buffer has remaining data as enough as specified in the data length field. |
|
boolean |
prefixedDataAvailable(int prefixLength,
int maxDataLength)
Returns true if this buffer contains a data which has a data length as a prefix and the buffer has remaining data as enough as specified in the data length field. |
|
IoBuffer |
put(byte b)
|
|
IoBuffer |
put(byte[] src)
|
|
IoBuffer |
put(byte[] src,
int offset,
int length)
|
|
IoBuffer |
put(ByteBuffer src)
Writes the content of the specified src into this buffer. |
|
IoBuffer |
put(int index,
byte b)
|
|
IoBuffer |
put(IoBuffer src)
Writes the content of the specified src into this buffer. |
|
IoBuffer |
putChar(char value)
|
|
IoBuffer |
putChar(int index,
char value)
|
|
IoBuffer |
putDouble(double value)
|
|
IoBuffer |
putDouble(int index,
double value)
|
|
IoBuffer |
putEnum(Enum<?> e)
Writes an enum's ordinal value to the buffer as a byte. |
|
IoBuffer |
putEnum(int index,
Enum<?> e)
Writes an enum's ordinal value to the buffer as a byte. |
|
IoBuffer |
putEnumInt(Enum<?> e)
Writes an enum's ordinal value to the buffer as an integer. |
|
IoBuffer |
putEnumInt(int index,
Enum<?> e)
Writes an enum's ordinal value to the buffer as an integer. |
|
|
putEnumSet(int index,
Set<E> set)
Writes the specified Set to the buffer as a byte sized bit vector. |
|
|
putEnumSet(Set<E> set)
Writes the specified Set to the buffer as a byte sized bit vector. |
|
|
putEnumSetInt(int index,
Set<E> set)
Writes the specified Set to the buffer as an int sized bit vector. |
|
|
putEnumSetInt(Set<E> set)
Writes the specified Set to the buffer as an int sized bit vector. |
|
|
putEnumSetLong(int index,
Set<E> set)
Writes the specified Set to the buffer as a long sized bit vector. |
|
|
putEnumSetLong(Set<E> set)
Writes the specified Set to the buffer as a long sized bit vector. |
|
|
putEnumSetShort(int index,
Set<E> set)
Writes the specified Set to the buffer as a short sized bit vector. |
|
|
putEnumSetShort(Set<E> set)
Writes the specified Set to the buffer as a short sized bit vector. |
|
IoBuffer |
putEnumShort(Enum<?> e)
Writes an enum's ordinal value to the buffer as a short. |
|
IoBuffer |
putEnumShort(int index,
Enum<?> e)
Writes an enum's ordinal value to the buffer as a short. |
|
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 |
putMediumInt(int value)
Relative put method for writing a medium int value. |
|
IoBuffer |
putMediumInt(int index,
int value)
Absolute put method for writing a medium int value. |
|
IoBuffer |
putObject(Object o)
Writes the specified Java object to the buffer. |
|
IoBuffer |
putPrefixedString(CharSequence in,
CharsetEncoder encoder)
Writes the content of in into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder. |
|
IoBuffer |
putPrefixedString(CharSequence in,
int prefixLength,
CharsetEncoder encoder)
Writes the content of in into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder. |
|
IoBuffer |
putPrefixedString(CharSequence val,
int prefixLength,
int padding,
byte padValue,
CharsetEncoder encoder)
Writes the content of in into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder. |
|
IoBuffer |
putPrefixedString(CharSequence in,
int prefixLength,
int padding,
CharsetEncoder encoder)
Writes the content of in into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder. |
|
IoBuffer |
putShort(int index,
short value)
|
|
IoBuffer |
putShort(short value)
|
|
IoBuffer |
putString(CharSequence val,
CharsetEncoder encoder)
Writes the content of in into this buffer using the
specified encoder. |
|
IoBuffer |
putString(CharSequence val,
int fieldSize,
CharsetEncoder encoder)
Writes the content of in into this buffer as a
NUL-terminated string using the specified
encoder. |
|
int |
remaining()
|
|
IoBuffer |
reset()
|
|
IoBuffer |
rewind()
|
|
IoBuffer |
setAutoExpand(boolean autoExpand)
Turns on or off autoExpand. |
|
IoBuffer |
setAutoShrink(boolean autoShrink)
Turns on or off autoShrink. |
|
IoBuffer |
shrink()
Changes the capacity of this buffer so this buffer occupies as less memory as possible while retaining the position, limit and the buffer content between the position and limit. |
|
IoBuffer |
skip(int size)
Forwards the position of this buffer as the specified size
bytes. |
|
IoBuffer |
slice()
|
|
protected abstract IoBuffer |
slice0()
Implement this method to return the unexpandable slice of this buffer. |
|
IoBuffer |
sweep()
Clears this buffer and fills its content with NUL. |
|
IoBuffer |
sweep(byte value)
double Clears this buffer and fills its content with value. |
|
String |
toString()
|
|
| Methods inherited from class org.apache.mina.core.buffer.IoBuffer |
|---|
allocate, allocate, array, arrayOffset, buf, free, getAllocator, hasArray, isUseDirectBuffer, normalizeCapacity, setAllocator, setUseDirectBuffer, wrap, wrap, wrap |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractIoBuffer(IoBufferAllocator allocator,
int initialCapacity)
protected AbstractIoBuffer(AbstractIoBuffer parent)
| Method Detail |
|---|
public final boolean isDirect()
isDirect in class IoBufferByteBuffer.isDirect()public final boolean isReadOnly()
isReadOnly in class IoBufferBuffer.isReadOnly()protected abstract void buf(ByteBuffer newBuf)
public final int minimumCapacity()
IoBufferIoBuffer.compact() and
IoBuffer.shrink() operation. The default value is the initial capacity
of the buffer.
minimumCapacity in class IoBufferpublic final IoBuffer minimumCapacity(int minimumCapacity)
IoBufferIoBuffer.compact() and
IoBuffer.shrink() operation. The default value is the initial capacity
of the buffer.
minimumCapacity in class IoBufferpublic final int capacity()
capacity in class IoBufferBuffer.capacity()public final IoBuffer capacity(int newCapacity)
IoBuffer
capacity in class IoBufferpublic final boolean isAutoExpand()
IoBuffer
isAutoExpand in class IoBufferpublic final boolean isAutoShrink()
IoBuffer
isAutoShrink in class IoBufferpublic final boolean isDerived()
IoBufferIoBuffer.duplicate(), IoBuffer.slice() or IoBuffer.asReadOnlyBuffer().
isDerived in class IoBufferpublic final IoBuffer setAutoExpand(boolean autoExpand)
IoBuffer
setAutoExpand in class IoBufferpublic final IoBuffer setAutoShrink(boolean autoShrink)
IoBuffer
setAutoShrink in class IoBufferpublic final IoBuffer expand(int expectedRemaining)
IoBuffer
expand in class IoBuffer
public final IoBuffer expand(int pos,
int expectedRemaining)
IoBuffer
expand in class IoBufferpublic final IoBuffer shrink()
IoBufferIoBuffer.minimumCapacity().
The mark is discarded once the capacity changes.
shrink in class IoBufferpublic final int position()
position in class IoBufferBuffer.position()public final IoBuffer position(int newPosition)
position in class IoBufferBuffer.position(int)public final int limit()
limit in class IoBufferBuffer.limit()public final IoBuffer limit(int newLimit)
limit in class IoBufferBuffer.limit(int)public final IoBuffer mark()
mark in class IoBufferBuffer.mark()public final int markValue()
IoBuffer
markValue in class IoBufferpublic final IoBuffer reset()
reset in class IoBufferBuffer.reset()public final IoBuffer clear()
clear in class IoBufferBuffer.clear()public final IoBuffer sweep()
IoBuffer
sweep in class IoBufferpublic final IoBuffer sweep(byte value)
IoBuffer
sweep in class IoBufferpublic final IoBuffer flip()
flip in class IoBufferBuffer.flip()public final IoBuffer rewind()
rewind in class IoBufferBuffer.rewind()public final int remaining()
remaining in class IoBufferBuffer.remaining()public final boolean hasRemaining()
hasRemaining in class IoBufferBuffer.hasRemaining()public final byte get()
get in class IoBufferByteBuffer.get()public final short getUnsigned()
IoBuffer
getUnsigned in class IoBufferpublic final IoBuffer put(byte b)
put in class IoBufferByteBuffer.put(byte)public final byte get(int index)
get in class IoBufferByteBuffer.get(int)public final short getUnsigned(int index)
IoBuffer
getUnsigned in class IoBuffer
public final IoBuffer put(int index,
byte b)
put in class IoBufferByteBuffer.put(int, byte)
public final IoBuffer get(byte[] dst,
int offset,
int length)
get in class IoBufferByteBuffer.get(byte[], int, int)public final IoBuffer put(ByteBuffer src)
IoBuffer
put in class IoBuffer
public final IoBuffer put(byte[] src,
int offset,
int length)
put in class IoBufferByteBuffer.put(byte[], int, int)public final IoBuffer compact()
compact in class IoBufferByteBuffer.compact()public final ByteOrder order()
order in class IoBufferByteBuffer.order()public final IoBuffer order(ByteOrder bo)
order in class IoBufferByteBuffer.order(ByteOrder)public final char getChar()
getChar in class IoBufferByteBuffer.getChar()public final IoBuffer putChar(char value)
putChar in class IoBufferByteBuffer.putChar(char)public final char getChar(int index)
getChar in class IoBufferByteBuffer.getChar(int)
public final IoBuffer putChar(int index,
char value)
putChar in class IoBufferByteBuffer.putChar(int, char)public final CharBuffer asCharBuffer()
asCharBuffer in class IoBufferByteBuffer.asCharBuffer()public final short getShort()
getShort in class IoBufferByteBuffer.getShort()public final IoBuffer putShort(short value)
putShort in class IoBufferByteBuffer.putShort(short)public final short getShort(int index)
getShort in class IoBufferByteBuffer.getShort()
public final IoBuffer putShort(int index,
short value)
putShort in class IoBufferByteBuffer.putShort(int, short)public final ShortBuffer asShortBuffer()
asShortBuffer in class IoBufferByteBuffer.asShortBuffer()public final int getInt()
getInt in class IoBufferByteBuffer.getInt()public final IoBuffer putInt(int value)
putInt in class IoBufferByteBuffer.putInt(int)public final int getInt(int index)
getInt in class IoBufferByteBuffer.getInt(int)
public final IoBuffer putInt(int index,
int value)
putInt in class IoBufferByteBuffer.putInt(int, int)public final IntBuffer asIntBuffer()
asIntBuffer in class IoBufferByteBuffer.asIntBuffer()public final long getLong()
getLong in class IoBufferByteBuffer.getLong()public final IoBuffer putLong(long value)
putLong in class IoBufferByteBuffer.putLong(int, long)public final long getLong(int index)
getLong in class IoBufferByteBuffer.getLong(int)
public final IoBuffer putLong(int index,
long value)
putLong in class IoBufferByteBuffer.putLong(int, long)public final LongBuffer asLongBuffer()
asLongBuffer in class IoBufferByteBuffer.asLongBuffer()public final float getFloat()
getFloat in class IoBufferByteBuffer.getFloat()public final IoBuffer putFloat(float value)
putFloat in class IoBufferByteBuffer.putFloat(float)public final float getFloat(int index)
getFloat in class IoBufferByteBuffer.getFloat(int)
public final IoBuffer putFloat(int index,
float value)
putFloat in class IoBufferByteBuffer.putFloat(int, float)public final FloatBuffer asFloatBuffer()
asFloatBuffer in class IoBufferByteBuffer.asFloatBuffer()public final double getDouble()
getDouble in class IoBufferByteBuffer.getDouble()public final IoBuffer putDouble(double value)
putDouble in class IoBufferByteBuffer.putDouble(double)public final double getDouble(int index)
getDouble in class IoBufferByteBuffer.getDouble(int)
public final IoBuffer putDouble(int index,
double value)
putDouble in class IoBufferByteBuffer.putDouble(int, double)public final DoubleBuffer asDoubleBuffer()
asDoubleBuffer in class IoBufferByteBuffer.asDoubleBuffer()public final IoBuffer asReadOnlyBuffer()
asReadOnlyBuffer in class IoBufferByteBuffer.asReadOnlyBuffer()protected abstract IoBuffer asReadOnlyBuffer0()
public final IoBuffer duplicate()
duplicate in class IoBufferByteBuffer.duplicate()protected abstract IoBuffer duplicate0()
public final IoBuffer slice()
slice in class IoBufferByteBuffer.slice()
public final IoBuffer getSlice(int index,
int length)
IoBuffer
getSlice in class IoBufferpublic final IoBuffer getSlice(int length)
IoBuffer
getSlice in class IoBufferprotected abstract IoBuffer slice0()
public int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int compareTo(IoBuffer that)
public String toString()
toString in class Objectpublic IoBuffer get(byte[] dst)
get in class IoBufferByteBuffer.get(byte[])public IoBuffer put(IoBuffer src)
IoBuffer
put in class IoBufferpublic IoBuffer put(byte[] src)
put in class IoBufferByteBuffer.put(byte[])public int getUnsignedShort()
IoBuffer
getUnsignedShort in class IoBufferpublic int getUnsignedShort(int index)
IoBuffer
getUnsignedShort in class IoBufferpublic long getUnsignedInt()
IoBuffer
getUnsignedInt in class IoBufferpublic int getMediumInt()
IoBufferReads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order, and then increments the position by three.
getMediumInt in class IoBufferpublic int getUnsignedMediumInt()
IoBufferReads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order, and then increments the position by three.
getUnsignedMediumInt in class IoBufferpublic int getMediumInt(int index)
IoBufferReads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order.
getMediumInt in class IoBufferindex - The index from which the medium int will be read
public int getUnsignedMediumInt(int index)
IoBufferReads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order.
getUnsignedMediumInt in class IoBufferindex - The index from which the unsigned medium int will be read
public IoBuffer putMediumInt(int value)
IoBufferWrites three bytes containing the given int value, in the current byte order, into this buffer at the current position, and then increments the position by three.
putMediumInt in class IoBuffervalue - The medium int value to be written
public IoBuffer putMediumInt(int index,
int value)
IoBufferWrites three bytes containing the given int value, in the current byte order, into this buffer at the given index.
putMediumInt in class IoBufferindex - The index at which the bytes will be writtenvalue - The medium int value to be written
public long getUnsignedInt(int index)
IoBuffer
getUnsignedInt in class IoBufferpublic InputStream asInputStream()
IoBufferInputStream that reads the data from this buffer.
InputStream.read() returns -1 if the buffer position
reaches to the limit.
asInputStream in class IoBufferpublic OutputStream asOutputStream()
IoBufferOutputStream that appends the data into this buffer.
Please note that the OutputStream.write(int) will throw a
BufferOverflowException instead of an IOException
in case of buffer overflow. Please set autoExpand property by
calling IoBuffer.setAutoExpand(boolean) to prevent the unexpected runtime
exception.
asOutputStream in class IoBufferpublic String getHexDump()
IoBuffer
getHexDump in class IoBufferpublic String getHexDump(int lengthLimit)
IoBuffer
getHexDump in class IoBufferlengthLimit - The maximum number of bytes to dump from
the current buffer position.
public String getString(CharsetDecoder decoder)
throws CharacterCodingException
IoBufferNUL-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 IoBufferCharacterCodingException
public String getString(int fieldSize,
CharsetDecoder decoder)
throws CharacterCodingException
IoBufferNUL-terminated string from this buffer using the
specified decoder and returns it.
getString in class IoBufferfieldSize - the maximum number of bytes to read
CharacterCodingException
public IoBuffer putString(CharSequence val,
CharsetEncoder encoder)
throws CharacterCodingException
IoBufferin 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 IoBufferCharacterCodingException
public IoBuffer putString(CharSequence val,
int fieldSize,
CharsetEncoder encoder)
throws CharacterCodingException
IoBufferin 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 IoBufferfieldSize - the maximum number of bytes to write
CharacterCodingException
public String getPrefixedString(CharsetDecoder decoder)
throws CharacterCodingException
IoBufferdecoder and returns it.
This method is a shortcut for getPrefixedString(2, decoder).
getPrefixedString in class IoBufferCharacterCodingException
public String getPrefixedString(int prefixLength,
CharsetDecoder decoder)
throws CharacterCodingException
decoder and returns it.
getPrefixedString in class IoBufferprefixLength - the length of the length field (1, 2, or 4)decoder - the decoder to use for decoding the string
CharacterCodingException - when decoding fails
BufferUnderflowException - when there is not enough data available
public IoBuffer putPrefixedString(CharSequence in,
CharsetEncoder encoder)
throws CharacterCodingException
IoBufferin into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder.
This method is a shortcut for putPrefixedString(in, 2, 0, encoder).
putPrefixedString in class IoBufferCharacterCodingException
public IoBuffer putPrefixedString(CharSequence in,
int prefixLength,
CharsetEncoder encoder)
throws CharacterCodingException
IoBufferin into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder.
This method is a shortcut for putPrefixedString(in, prefixLength, 0, encoder).
putPrefixedString in class IoBufferprefixLength - the length of the length field (1, 2, or 4)
CharacterCodingException
public IoBuffer putPrefixedString(CharSequence in,
int prefixLength,
int padding,
CharsetEncoder encoder)
throws CharacterCodingException
IoBufferin into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder.
This method is a shortcut for putPrefixedString(in, prefixLength, padding, ( byte ) 0, encoder).
putPrefixedString in class IoBufferprefixLength - the length of the length field (1, 2, or 4)padding - the number of padded NULs (1 (or 0), 2, or 4)
CharacterCodingException
public IoBuffer putPrefixedString(CharSequence val,
int prefixLength,
int padding,
byte padValue,
CharsetEncoder encoder)
throws CharacterCodingException
IoBufferin into this buffer as a
string which has a 16-bit length field before the actual
encoded string, using the specified encoder.
putPrefixedString in class IoBufferprefixLength - the length of the length field (1, 2, or 4)padding - the number of padded bytes (1 (or 0), 2, or 4)padValue - the value of padded bytes
CharacterCodingException
public Object getObject()
throws ClassNotFoundException
IoBufferClassLoader
of the current thread.
getObject in class IoBufferClassNotFoundException
public Object getObject(ClassLoader classLoader)
throws ClassNotFoundException
IoBuffer
getObject in class IoBufferClassNotFoundExceptionpublic IoBuffer putObject(Object o)
IoBuffer
putObject in class IoBufferpublic boolean prefixedDataAvailable(int prefixLength)
IoBufferIoBuffer.prefixedDataAvailable(int, int)
instead.
prefixedDataAvailable in class IoBufferprefixLength - the length of the prefix field (1, 2, or 4)
public boolean prefixedDataAvailable(int prefixLength,
int maxDataLength)
IoBuffer
prefixedDataAvailable in class IoBufferprefixLength - the length of the prefix field (1, 2, or 4)maxDataLength - the allowed maximum of the read data lengthpublic int indexOf(byte b)
IoBuffer
indexOf in class IoBufferpublic IoBuffer skip(int size)
IoBuffersize
bytes.
skip in class IoBuffer
public IoBuffer fill(byte value,
int size)
IoBuffer
fill in class IoBuffer
public IoBuffer fillAndReset(byte value,
int size)
IoBuffer
fillAndReset in class IoBufferpublic IoBuffer fill(int size)
IoBufferNUL (0x00).
This method moves buffer position forward.
fill in class IoBufferpublic IoBuffer fillAndReset(int size)
IoBufferNUL (0x00).
This method does not change buffer position.
fillAndReset in class IoBufferpublic <E extends Enum<E>> E getEnum(Class<E> enumClass)
IoBuffer
getEnum in class IoBufferE - The enum type to returnenumClass - The enum's class object
public <E extends Enum<E>> E getEnum(int index,
Class<E> enumClass)
IoBuffer
getEnum in class IoBufferE - The enum type to returnindex - the index from which the byte will be readenumClass - The enum's class objectpublic <E extends Enum<E>> E getEnumShort(Class<E> enumClass)
IoBuffer
getEnumShort in class IoBufferE - The enum type to returnenumClass - The enum's class object
public <E extends Enum<E>> E getEnumShort(int index,
Class<E> enumClass)
IoBuffer
getEnumShort in class IoBufferE - The enum type to returnindex - the index from which the bytes will be readenumClass - The enum's class objectpublic <E extends Enum<E>> E getEnumInt(Class<E> enumClass)
IoBuffer
getEnumInt in class IoBufferE - The enum type to returnenumClass - The enum's class object
public <E extends Enum<E>> E getEnumInt(int index,
Class<E> enumClass)
IoBuffer
getEnumInt in class IoBufferE - The enum type to returnindex - the index from which the bytes will be readenumClass - The enum's class objectpublic IoBuffer putEnum(Enum<?> e)
IoBuffer
putEnum in class IoBuffere - The enum to write to the buffer
public IoBuffer putEnum(int index,
Enum<?> e)
IoBuffer
putEnum in class IoBufferindex - The index at which the byte will be writtene - The enum to write to the bufferpublic IoBuffer putEnumShort(Enum<?> e)
IoBuffer
putEnumShort in class IoBuffere - The enum to write to the buffer
public IoBuffer putEnumShort(int index,
Enum<?> e)
IoBuffer
putEnumShort in class IoBufferindex - The index at which the bytes will be writtene - The enum to write to the bufferpublic IoBuffer putEnumInt(Enum<?> e)
IoBuffer
putEnumInt in class IoBuffere - The enum to write to the buffer
public IoBuffer putEnumInt(int index,
Enum<?> e)
IoBuffer
putEnumInt in class IoBufferindex - The index at which the bytes will be writtene - The enum to write to the bufferpublic <E extends Enum<E>> EnumSet<E> getEnumSet(Class<E> enumClass)
IoBufferEnumSet.
Each bit is mapped to a value in the specified enum. The least significant bit maps to the first entry in the specified enum and each subsequent bit maps to each subsequent bit as mapped to the subsequent enum value.
getEnumSet in class IoBufferE - the enum typeenumClass - the enum class used to create the EnumSet
public <E extends Enum<E>> EnumSet<E> getEnumSet(int index,
Class<E> enumClass)
IoBufferEnumSet.
getEnumSet in class IoBufferE - the enum typeindex - the index from which the byte will be readenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)public <E extends Enum<E>> EnumSet<E> getEnumSetShort(Class<E> enumClass)
IoBufferEnumSet.
getEnumSetShort in class IoBufferE - the enum typeenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)
public <E extends Enum<E>> EnumSet<E> getEnumSetShort(int index,
Class<E> enumClass)
IoBufferEnumSet.
getEnumSetShort in class IoBufferE - the enum typeindex - the index from which the bytes will be readenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)public <E extends Enum<E>> EnumSet<E> getEnumSetInt(Class<E> enumClass)
IoBufferEnumSet.
getEnumSetInt in class IoBufferE - the enum typeenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)
public <E extends Enum<E>> EnumSet<E> getEnumSetInt(int index,
Class<E> enumClass)
IoBufferEnumSet.
getEnumSetInt in class IoBufferE - the enum typeindex - the index from which the bytes will be readenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)public <E extends Enum<E>> EnumSet<E> getEnumSetLong(Class<E> enumClass)
IoBufferEnumSet.
getEnumSetLong in class IoBufferE - the enum typeenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)
public <E extends Enum<E>> EnumSet<E> getEnumSetLong(int index,
Class<E> enumClass)
IoBufferEnumSet.
getEnumSetLong in class IoBufferE - the enum typeindex - the index from which the bytes will be readenumClass - the enum class used to create the EnumSet
IoBuffer.getEnumSet(Class)public <E extends Enum<E>> IoBuffer putEnumSet(Set<E> set)
IoBufferSet to the buffer as a byte sized bit vector.
putEnumSet in class IoBufferE - the enum type of the Setset - the enum set to write to the buffer
public <E extends Enum<E>> IoBuffer putEnumSet(int index,
Set<E> set)
IoBufferSet to the buffer as a byte sized bit vector.
putEnumSet in class IoBufferE - the enum type of the Setindex - the index at which the byte will be writtenset - the enum set to write to the bufferpublic <E extends Enum<E>> IoBuffer putEnumSetShort(Set<E> set)
IoBufferSet to the buffer as a short sized bit vector.
putEnumSetShort in class IoBufferE - the enum type of the Setset - the enum set to write to the buffer
public <E extends Enum<E>> IoBuffer putEnumSetShort(int index,
Set<E> set)
IoBufferSet to the buffer as a short sized bit vector.
putEnumSetShort in class IoBufferE - the enum type of the Setindex - the index at which the bytes will be writtenset - the enum set to write to the bufferpublic <E extends Enum<E>> IoBuffer putEnumSetInt(Set<E> set)
IoBufferSet to the buffer as an int sized bit vector.
putEnumSetInt in class IoBufferE - the enum type of the Setset - the enum set to write to the buffer
public <E extends Enum<E>> IoBuffer putEnumSetInt(int index,
Set<E> set)
IoBufferSet to the buffer as an int sized bit vector.
putEnumSetInt in class IoBufferE - the enum type of the Setindex - the index at which the bytes will be writtenset - the enum set to write to the bufferpublic <E extends Enum<E>> IoBuffer putEnumSetLong(Set<E> set)
IoBufferSet to the buffer as a long sized bit vector.
putEnumSetLong in class IoBufferE - the enum type of the Setset - the enum set to write to the buffer
public <E extends Enum<E>> IoBuffer putEnumSetLong(int index,
Set<E> set)
IoBufferSet to the buffer as a long sized bit vector.
putEnumSetLong in class IoBufferE - the enum type of the Setindex - the index at which the bytes will be writtenset - the enum set to write to the buffer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||