Methods Summary |
---|
public java.nio.ByteBuffer | asReadOnlyBuffer()
return ReadOnlyHeapByteBuffer.copy(this, mark);
|
public java.nio.ByteBuffer | compact()
System.arraycopy(backingArray, position + offset, backingArray, offset,
remaining());
position = limit - position;
limit = capacity;
mark = UNSET_MARK;
return this;
|
static java.nio.ReadWriteHeapByteBuffer | copy(java.nio.HeapByteBuffer other, int markOfOther)
ReadWriteHeapByteBuffer buf = new ReadWriteHeapByteBuffer(
other.backingArray, other.capacity(), other.offset);
buf.limit = other.limit();
buf.position = other.position();
buf.mark = markOfOther;
buf.order(other.order());
return buf;
|
public java.nio.ByteBuffer | duplicate()
return copy(this, mark);
|
public boolean | isReadOnly()
return false;
|
protected byte[] | protectedArray()
return backingArray;
|
protected int | protectedArrayOffset()
return offset;
|
protected boolean | protectedHasArray()
return true;
|
public java.nio.ByteBuffer | put(byte b)
if (position == limit) {
throw new BufferOverflowException();
}
backingArray[offset + position++] = b;
return this;
|
public java.nio.ByteBuffer | put(int index, byte b)
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
backingArray[offset + index] = b;
return this;
|
public java.nio.ByteBuffer | put(byte[] src, int off, int len)
if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferOverflowException();
}
if (isReadOnly()) {
throw new ReadOnlyBufferException();
}
System.arraycopy(src, off, backingArray, offset
+ position, len);
position += len;
return this;
|
public java.nio.ByteBuffer | putDouble(double value)
return putLong(Double.doubleToRawLongBits(value));
|
public java.nio.ByteBuffer | putDouble(int index, double value)
return putLong(index, Double.doubleToRawLongBits(value));
|
public java.nio.ByteBuffer | putFloat(float value)
return putInt(Float.floatToIntBits(value));
|
public java.nio.ByteBuffer | putFloat(int index, float value)
return putInt(index, Float.floatToIntBits(value));
|
public java.nio.ByteBuffer | putInt(int value)
int newPosition = position + 4;
if (newPosition > limit) {
throw new BufferOverflowException();
}
store(position, value);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putInt(int index, int value)
if (index < 0 || (long)index + 4 > limit) {
throw new IndexOutOfBoundsException();
}
store(index, value);
return this;
|
public java.nio.ByteBuffer | putLong(int index, long value)
if (index < 0 || (long)index + 8 > limit) {
throw new IndexOutOfBoundsException();
}
store(index, value);
return this;
|
public java.nio.ByteBuffer | putLong(long value)
int newPosition = position + 8;
if (newPosition > limit) {
throw new BufferOverflowException();
}
store(position, value);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putShort(int index, short value)
if (index < 0 || (long)index + 2 > limit) {
throw new IndexOutOfBoundsException();
}
store(index, value);
return this;
|
public java.nio.ByteBuffer | putShort(short value)
int newPosition = position + 2;
if (newPosition > limit) {
throw new BufferOverflowException();
}
store(position, value);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | slice()
ReadWriteHeapByteBuffer slice = new ReadWriteHeapByteBuffer(
backingArray, remaining(), offset + position);
slice.order = order;
return slice;
|