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 | Description |
---|---|---|
protected |
BaseByteBuffer() |
Modifier and Type | Method | 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(int index,
byte b) |
|
ByteBuffer |
put(java.nio.ByteBuffer src) |
Writes the content of the specified src into this buffer.
|
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, wrap
public boolean isDirect()
isDirect
in class ByteBuffer
ByteBuffer.isDirect()
public boolean isReadOnly()
isReadOnly
in class ByteBuffer
Buffer.isReadOnly()
public int capacity()
capacity
in class ByteBuffer
Buffer.capacity()
public ByteBuffer capacity(int newCapacity)
ByteBuffer
capacity
in class ByteBuffer
protected abstract void capacity0(int newCapacity)
public boolean isAutoExpand()
ByteBuffer
isAutoExpand
in class ByteBuffer
public ByteBuffer setAutoExpand(boolean autoExpand)
ByteBuffer
setAutoExpand
in class ByteBuffer
public ByteBuffer expand(int pos, int expectedRemaining)
ByteBuffer
expand
in class ByteBuffer
public int position()
position
in class ByteBuffer
Buffer.position()
public ByteBuffer position(int newPosition)
position
in class ByteBuffer
Buffer.position(int)
public int limit()
limit
in class ByteBuffer
Buffer.limit()
public ByteBuffer limit(int newLimit)
limit
in class ByteBuffer
Buffer.limit(int)
public ByteBuffer mark()
mark
in class ByteBuffer
Buffer.mark()
public int markValue()
ByteBuffer
markValue
in class ByteBuffer
public ByteBuffer reset()
reset
in class ByteBuffer
Buffer.reset()
public ByteBuffer clear()
clear
in class ByteBuffer
Buffer.clear()
public ByteBuffer flip()
flip
in class ByteBuffer
Buffer.flip()
public ByteBuffer rewind()
rewind
in class ByteBuffer
Buffer.rewind()
public byte get()
get
in class ByteBuffer
ByteBuffer.get()
public ByteBuffer put(byte b)
put
in class ByteBuffer
ByteBuffer.put(byte)
public byte get(int index)
get
in class ByteBuffer
ByteBuffer.get(int)
public ByteBuffer put(int index, byte b)
put
in class ByteBuffer
ByteBuffer.put(int, byte)
public ByteBuffer get(byte[] dst, int offset, int length)
get
in class ByteBuffer
ByteBuffer.get(byte[], int, int)
public ByteBuffer put(java.nio.ByteBuffer src)
ByteBuffer
put
in class ByteBuffer
public ByteBuffer put(byte[] src, int offset, int length)
put
in class ByteBuffer
ByteBuffer.put(byte[], int, int)
public ByteBuffer compact()
compact
in class ByteBuffer
ByteBuffer.compact()
public java.nio.ByteOrder order()
order
in class ByteBuffer
ByteBuffer.order()
public ByteBuffer order(java.nio.ByteOrder bo)
order
in class ByteBuffer
ByteBuffer.order(ByteOrder)
public char getChar()
getChar
in class ByteBuffer
ByteBuffer.getChar()
public ByteBuffer putChar(char value)
putChar
in class ByteBuffer
ByteBuffer.putChar(char)
public char getChar(int index)
getChar
in class ByteBuffer
ByteBuffer.getChar(int)
public ByteBuffer putChar(int index, char value)
putChar
in class ByteBuffer
ByteBuffer.putChar(int, char)
public java.nio.CharBuffer asCharBuffer()
asCharBuffer
in class ByteBuffer
ByteBuffer.asCharBuffer()
public short getShort()
getShort
in class ByteBuffer
ByteBuffer.getShort()
public ByteBuffer putShort(short value)
putShort
in class ByteBuffer
ByteBuffer.putShort(short)
public short getShort(int index)
getShort
in class ByteBuffer
ByteBuffer.getShort()
public ByteBuffer putShort(int index, short value)
putShort
in class ByteBuffer
ByteBuffer.putShort(int, short)
public java.nio.ShortBuffer asShortBuffer()
asShortBuffer
in class ByteBuffer
ByteBuffer.asShortBuffer()
public int getInt()
getInt
in class ByteBuffer
ByteBuffer.getInt()
public ByteBuffer putInt(int value)
putInt
in class ByteBuffer
ByteBuffer.putInt(int)
public int getInt(int index)
getInt
in class ByteBuffer
ByteBuffer.getInt(int)
public ByteBuffer putInt(int index, int value)
putInt
in class ByteBuffer
ByteBuffer.putInt(int, int)
public java.nio.IntBuffer asIntBuffer()
asIntBuffer
in class ByteBuffer
ByteBuffer.asIntBuffer()
public long getLong()
getLong
in class ByteBuffer
ByteBuffer.getLong()
public ByteBuffer putLong(long value)
putLong
in class ByteBuffer
ByteBuffer.putLong(int, long)
public long getLong(int index)
getLong
in class ByteBuffer
ByteBuffer.getLong(int)
public ByteBuffer putLong(int index, long value)
putLong
in class ByteBuffer
ByteBuffer.putLong(int, long)
public java.nio.LongBuffer asLongBuffer()
asLongBuffer
in class ByteBuffer
ByteBuffer.asLongBuffer()
public float getFloat()
getFloat
in class ByteBuffer
ByteBuffer.getFloat()
public ByteBuffer putFloat(float value)
putFloat
in class ByteBuffer
ByteBuffer.putFloat(float)
public float getFloat(int index)
getFloat
in class ByteBuffer
ByteBuffer.getFloat(int)
public ByteBuffer putFloat(int index, float value)
putFloat
in class ByteBuffer
ByteBuffer.putFloat(int, float)
public java.nio.FloatBuffer asFloatBuffer()
asFloatBuffer
in class ByteBuffer
ByteBuffer.asFloatBuffer()
public double getDouble()
getDouble
in class ByteBuffer
ByteBuffer.getDouble()
public ByteBuffer putDouble(double value)
putDouble
in class ByteBuffer
ByteBuffer.putDouble(double)
public double getDouble(int index)
getDouble
in class ByteBuffer
ByteBuffer.getDouble(int)
public ByteBuffer putDouble(int index, double value)
putDouble
in class ByteBuffer
ByteBuffer.putDouble(int, double)
public java.nio.DoubleBuffer asDoubleBuffer()
asDoubleBuffer
in class ByteBuffer
ByteBuffer.asDoubleBuffer()