Methods Summary |
---|
public final void | addressValidityCheck()
if (!isAddressValid()) {
// nio.08=Cannot use the direct byte buffer after it has been explicitly freed.
throw new IllegalStateException(
Messages.getString("nio.08")); //$NON-NLS-1$
}
|
public final void | free()Explicitly free the memory used by this direct byte buffer. If the memory
has already been freed then this is a no-op. Once the memory has been
freed then operations requiring access to the memory will throw an
IllegalStateException .
Note this is is possible that the memory is freed by code that reaches
into the address and explicitly frees it 'beneith' us -- this is bad
form.
if (isAddressValid()) {
markAddressInvalid();
safeAddress.address.free();
}
|
public final java.nio.ByteBuffer | get(byte[] dest, int off, int len)
int length = dest.length;
if ((off < 0 ) || (len < 0) || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferUnderflowException();
}
getBaseAddress().getByteArray(offset+position, dest, off, len);
position += len;
return this;
|
public final byte | get()
if (position == limit) {
throw new BufferUnderflowException();
}
return getBaseAddress().getByte(offset + position++);
|
public final byte | get(int index)
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
return getBaseAddress().getByte(offset + index);
|
public final org.apache.harmony.luni.platform.PlatformAddress | getBaseAddress()
addressValidityCheck();
return safeAddress.address;
|
public final int | getByteCapacity()
return capacity;
|
public final double | getDouble()
int newPosition = position + 8;
if (newPosition > limit) {
throw new BufferUnderflowException();
}
double result = getBaseAddress().getDouble(offset + position, order);
position = newPosition;
return result;
|
public final double | getDouble(int index)
if (index < 0 || (long)index + 8 > limit) {
throw new IndexOutOfBoundsException();
}
return getBaseAddress().getDouble(offset + index, order);
|
public final org.apache.harmony.luni.platform.PlatformAddress | getEffectiveAddress()Returns the platform address of the start of this buffer instance.
You must not attempt to free the returned address!! It may not
be an address that was explicitly malloc'ed (i.e. if this buffer is the
result of a split); and it may be memory shared by multiple buffers.
If you can guarantee that you want to free the underlying memory call the
#free() method on this instance -- generally applications will rely on
the garbage collector to autofree this memory.
return getBaseAddress().offsetBytes(offset);
|
public final float | getFloat()
int newPosition = position + 4;
if (newPosition > limit) {
throw new BufferUnderflowException();
}
float result = getBaseAddress().getFloat(offset + position, order);
position = newPosition;
return result;
|
public final float | getFloat(int index)
if (index < 0 || (long)index + 4 > limit) {
throw new IndexOutOfBoundsException();
}
return getBaseAddress().getFloat(offset + index, order);
|
public final int | getInt()
int newPosition = position + 4;
if (newPosition > limit) {
throw new BufferUnderflowException();
}
int result = getBaseAddress().getInt(offset + position, order);
position = newPosition;
return result;
|
public final int | getInt(int index)
if (index < 0 || (long)index + 4 > limit) {
throw new IndexOutOfBoundsException();
}
return getBaseAddress().getInt(offset + index, order);
|
public final long | getLong()
int newPosition = position + 8;
if (newPosition > limit) {
throw new BufferUnderflowException();
}
long result = getBaseAddress().getLong(offset + position, order);
position = newPosition;
return result;
|
public final long | getLong(int index)
if (index < 0 || (long)index + 8 > limit) {
throw new IndexOutOfBoundsException();
}
return getBaseAddress().getLong(offset + index, order);
|
public final short | getShort()
int newPosition = position + 2;
if (newPosition > limit) {
throw new BufferUnderflowException();
}
short result = getBaseAddress().getShort(offset + position, order);
position = newPosition;
return result;
|
public final short | getShort(int index)
if (index < 0 || (long)index + 2 > limit) {
throw new IndexOutOfBoundsException();
}
return getBaseAddress().getShort(offset + index, order);
|
public final boolean | isAddressValid()
return safeAddress.isValid;
|
public final boolean | isDirect()
return true;
|
private void | markAddressInvalid()
safeAddress.isValid = false;
|
protected final byte[] | protectedArray()
throw new UnsupportedOperationException();
|
protected final int | protectedArrayOffset()
throw new UnsupportedOperationException();
|
protected final boolean | protectedHasArray()
return false;
|