Methods Summary |
---|
public java.nio.ByteBuffer | asReadOnlyBuffer()
return ReadOnlyDirectByteBuffer.copy(this, mark);
|
public java.nio.ByteBuffer | compact()
PlatformAddress effectiveAddress = getEffectiveAddress();
effectiveAddress.offsetBytes(position).moveTo(effectiveAddress,
remaining());
position = limit - position;
limit = capacity;
mark = UNSET_MARK;
return this;
|
static java.nio.ReadWriteDirectByteBuffer | copy(java.nio.DirectByteBuffer other, int markOfOther)
ReadWriteDirectByteBuffer buf = new ReadWriteDirectByteBuffer(
other.safeAddress, 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);
|
int | getAddress()
return this.safeAddress.address.toInt();
|
public boolean | isReadOnly()
return false;
|
public java.nio.ByteBuffer | put(byte value)
if (position == limit) {
throw new BufferOverflowException();
}
getBaseAddress().setByte(offset + position++, value);
return this;
|
public java.nio.ByteBuffer | put(int index, byte value)
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
getBaseAddress().setByte(offset + index, value);
return this;
|
public java.nio.ByteBuffer | put(byte[] src, int off, int len)
int length = src.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferOverflowException();
}
if (isReadOnly()) {
throw new ReadOnlyBufferException();
}
getBaseAddress().setByteArray(offset + position, src, off,
len);
position += len;
return this;
|
java.nio.ByteBuffer | put(short[] src, int off, int len)Writes short s in the given short array, starting from the
specified offset, to the current position and increase the position by
the number of short s written.
int length = src.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len << 1 > remaining()) {
throw new BufferOverflowException();
}
if (isReadOnly()) {
throw new ReadOnlyBufferException();
}
boolean swap = order() != ByteOrder.nativeOrder();
getBaseAddress().setShortArray(offset + position, src, off, len, swap);
position += len << 1;
return this;
|
java.nio.ByteBuffer | put(int[] src, int off, int len)Writes int s in the given int array, starting from the
specified offset, to the current position and increase the position by
the number of int s written.
int length = src.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len << 2 > remaining()) {
throw new BufferOverflowException();
}
if (isReadOnly()) {
throw new ReadOnlyBufferException();
}
boolean swap = order() != ByteOrder.nativeOrder();
getBaseAddress().setIntArray(offset + position, src, off, len, swap);
position += len << 2;
return this;
|
public java.nio.ByteBuffer | putDouble(double value)
int newPosition = position + 8;
if (newPosition > limit) {
throw new BufferOverflowException();
}
getBaseAddress().setDouble(offset + position, value, order);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putDouble(int index, double value)
if (index < 0 || (long)index + 8 > limit) {
throw new IndexOutOfBoundsException();
}
getBaseAddress().setDouble(offset + index, value, order);
return this;
|
public java.nio.ByteBuffer | putFloat(float value)
int newPosition = position + 4;
if (newPosition > limit) {
throw new BufferOverflowException();
}
getBaseAddress().setFloat(offset + position, value, order);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putFloat(int index, float value)
if (index < 0 || (long)index + 4 > limit) {
throw new IndexOutOfBoundsException();
}
getBaseAddress().setFloat(offset + index, value, order);
return this;
|
public java.nio.ByteBuffer | putInt(int value)
int newPosition = position + 4;
if (newPosition > limit) {
throw new BufferOverflowException();
}
getBaseAddress().setInt(offset + position, value, order);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putInt(int index, int value)
if (index < 0 || (long)index + 4 > limit) {
throw new IndexOutOfBoundsException();
}
getBaseAddress().setInt(offset + index, value, order);
return this;
|
public java.nio.ByteBuffer | putLong(long value)
int newPosition = position + 8;
if (newPosition > limit) {
throw new BufferOverflowException();
}
getBaseAddress().setLong(offset + position, value, order);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putLong(int index, long value)
if (index < 0 || (long)index + 8 > limit) {
throw new IndexOutOfBoundsException();
}
getBaseAddress().setLong(offset + index, value, order);
return this;
|
public java.nio.ByteBuffer | putShort(short value)
int newPosition = position + 2;
if (newPosition > limit) {
throw new BufferOverflowException();
}
getBaseAddress().setShort(offset + position, value, order);
position = newPosition;
return this;
|
public java.nio.ByteBuffer | putShort(int index, short value)
if (index < 0 || (long)index + 2 > limit) {
throw new IndexOutOfBoundsException();
}
getBaseAddress().setShort(offset + index, value, order);
return this;
|
public java.nio.ByteBuffer | slice()
ReadWriteDirectByteBuffer buf = new ReadWriteDirectByteBuffer(
safeAddress, remaining(), offset + position);
buf.order = order;
return buf;
|