public abstract class BaseByteBuffer extends ByteBuffer
ByteBuffer. This implementation
assumes that ByteBuffer.buf() always returns a correct NIO
ByteBuffer instance. Most implementations could
extend this class and implement their own buffer management mechanism.ByteBufferAllocator| Modifier | Constructor and Description |
|---|---|
protected |
BaseByteBuffer() |
| Modifier and Type | Method and Description |
|---|---|
java.nio.CharBuffer |
asCharBuffer() |
java.nio.DoubleBuffer |
asDoubleBuffer() |
java.nio.FloatBuffer |
asFloatBuffer() |
java.nio.IntBuffer |
asIntBuffer() |
java.nio.LongBuffer |
asLongBuffer() |
java.nio.ShortBuffer |
asShortBuffer() |
int |
capacity() |
ByteBuffer |
capacity(int newCapacity)
Changes the capacity of this buffer.
|
protected abstract void |
capacity0(int newCapacity)
Implement this method to increase the capacity of this buffer.
|
ByteBuffer |
clear() |
ByteBuffer |
compact() |
ByteBuffer |
expand(int pos,
int expectedRemaining)
Changes the capacity and limit of this buffer so this buffer get
the specified expectedRemaining room from the specified
pos.
|
ByteBuffer |
flip() |
byte |
get() |
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) |
int |
getInt() |
int |
getInt(int index) |
long |
getLong() |
long |
getLong(int index) |
short |
getShort() |
short |
getShort(int index) |
boolean |
isAutoExpand()
Returns true if and only if autoExpand is turned on.
|
boolean |
isDirect() |
boolean |
isReadOnly() |
int |
limit() |
ByteBuffer |
limit(int newLimit) |
ByteBuffer |
mark() |
int |
markValue()
Returns the position of the current 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,
int offset,
int length) |
ByteBuffer |
put(java.nio.ByteBuffer src)
Writes the content of the specified src into this buffer.
|
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 |
reset() |
ByteBuffer |
rewind() |
ByteBuffer |
setAutoExpand(boolean autoExpand)
Turns on or off autoExpand.
|
acquire, allocate, allocate, array, arrayOffset, asInputStream, asOutputStream, asReadOnlyBuffer, autoExpand, autoExpand, buf, compareTo, duplicate, equals, expand, fill, fill, fillAndReset, fillAndReset, get, getAllocator, getHexDump, getObject, getObject, getPrefixedString, getPrefixedString, getString, getString, getUnsigned, getUnsigned, getUnsignedInt, getUnsignedInt, getUnsignedShort, getUnsignedShort, hashCode, hasRemaining, isPooled, isUseDirectBuffers, prefixedDataAvailable, prefixedDataAvailable, put, put, putObject, putPrefixedString, putPrefixedString, putPrefixedString, putPrefixedString, putString, putString, release, remaining, setAllocator, setPooled, setUseDirectBuffers, skip, slice, sweep, sweep, toString, wrap, wrap, wrappublic boolean isDirect()
isDirect in class ByteBufferByteBuffer.isDirect()public boolean isReadOnly()
isReadOnly in class ByteBufferBuffer.isReadOnly()public int capacity()
capacity in class ByteBufferBuffer.capacity()public ByteBuffer capacity(int newCapacity)
ByteBuffercapacity in class ByteBufferprotected abstract void capacity0(int newCapacity)
public boolean isAutoExpand()
ByteBufferisAutoExpand in class ByteBufferpublic ByteBuffer setAutoExpand(boolean autoExpand)
ByteBuffersetAutoExpand in class ByteBufferpublic ByteBuffer expand(int pos, int expectedRemaining)
ByteBufferexpand in class ByteBufferpublic int position()
position in class ByteBufferBuffer.position()public ByteBuffer position(int newPosition)
position in class ByteBufferBuffer.position(int)public int limit()
limit in class ByteBufferBuffer.limit()public ByteBuffer limit(int newLimit)
limit in class ByteBufferBuffer.limit(int)public ByteBuffer mark()
mark in class ByteBufferBuffer.mark()public int markValue()
ByteBuffermarkValue in class ByteBufferpublic ByteBuffer reset()
reset in class ByteBufferBuffer.reset()public ByteBuffer clear()
clear in class ByteBufferBuffer.clear()public ByteBuffer flip()
flip in class ByteBufferBuffer.flip()public ByteBuffer rewind()
rewind in class ByteBufferBuffer.rewind()public byte get()
get in class ByteBufferByteBuffer.get()public ByteBuffer put(byte b)
put in class ByteBufferByteBuffer.put(byte)public byte get(int index)
get in class ByteBufferByteBuffer.get(int)public ByteBuffer put(int index, byte b)
put in class ByteBufferByteBuffer.put(int, byte)public ByteBuffer get(byte[] dst, int offset, int length)
get in class ByteBufferByteBuffer.get(byte[], int, int)public ByteBuffer put(java.nio.ByteBuffer src)
ByteBufferput in class ByteBufferpublic ByteBuffer put(byte[] src, int offset, int length)
put in class ByteBufferByteBuffer.put(byte[], int, int)public ByteBuffer compact()
compact in class ByteBufferByteBuffer.compact()public java.nio.ByteOrder order()
order in class ByteBufferByteBuffer.order()public ByteBuffer order(java.nio.ByteOrder bo)
order in class ByteBufferByteBuffer.order(ByteOrder)public char getChar()
getChar in class ByteBufferByteBuffer.getChar()public ByteBuffer putChar(char value)
putChar in class ByteBufferByteBuffer.putChar(char)public char getChar(int index)
getChar in class ByteBufferByteBuffer.getChar(int)public ByteBuffer putChar(int index, char value)
putChar in class ByteBufferByteBuffer.putChar(int, char)public java.nio.CharBuffer asCharBuffer()
asCharBuffer in class ByteBufferByteBuffer.asCharBuffer()public short getShort()
getShort in class ByteBufferByteBuffer.getShort()public ByteBuffer putShort(short value)
putShort in class ByteBufferByteBuffer.putShort(short)public short getShort(int index)
getShort in class ByteBufferByteBuffer.getShort()public ByteBuffer putShort(int index, short value)
putShort in class ByteBufferByteBuffer.putShort(int, short)public java.nio.ShortBuffer asShortBuffer()
asShortBuffer in class ByteBufferByteBuffer.asShortBuffer()public int getInt()
getInt in class ByteBufferByteBuffer.getInt()public ByteBuffer putInt(int value)
putInt in class ByteBufferByteBuffer.putInt(int)public int getInt(int index)
getInt in class ByteBufferByteBuffer.getInt(int)public ByteBuffer putInt(int index, int value)
putInt in class ByteBufferByteBuffer.putInt(int, int)public java.nio.IntBuffer asIntBuffer()
asIntBuffer in class ByteBufferByteBuffer.asIntBuffer()public long getLong()
getLong in class ByteBufferByteBuffer.getLong()public ByteBuffer putLong(long value)
putLong in class ByteBufferByteBuffer.putLong(int, long)public long getLong(int index)
getLong in class ByteBufferByteBuffer.getLong(int)public ByteBuffer putLong(int index, long value)
putLong in class ByteBufferByteBuffer.putLong(int, long)public java.nio.LongBuffer asLongBuffer()
asLongBuffer in class ByteBufferByteBuffer.asLongBuffer()public float getFloat()
getFloat in class ByteBufferByteBuffer.getFloat()public ByteBuffer putFloat(float value)
putFloat in class ByteBufferByteBuffer.putFloat(float)public float getFloat(int index)
getFloat in class ByteBufferByteBuffer.getFloat(int)public ByteBuffer putFloat(int index, float value)
putFloat in class ByteBufferByteBuffer.putFloat(int, float)public java.nio.FloatBuffer asFloatBuffer()
asFloatBuffer in class ByteBufferByteBuffer.asFloatBuffer()public double getDouble()
getDouble in class ByteBufferByteBuffer.getDouble()public ByteBuffer putDouble(double value)
putDouble in class ByteBufferByteBuffer.putDouble(double)public double getDouble(int index)
getDouble in class ByteBufferByteBuffer.getDouble(int)public ByteBuffer putDouble(int index, double value)
putDouble in class ByteBufferByteBuffer.putDouble(int, double)public java.nio.DoubleBuffer asDoubleBuffer()
asDoubleBuffer in class ByteBufferByteBuffer.asDoubleBuffer()