| Method from sun.nio.ch.NativeObject Detail: |
long address() {
return address;
}
Returns the native base address of this native object. |
static int addressSize() {
return unsafe.addressSize();
}
Returns the native architecture's address size in bytes. |
long allocationAddress() {
return allocationAddress;
}
|
static ByteOrder byteOrder() {
if (byteOrder != null)
return byteOrder;
long a = unsafe.allocateMemory(8);
try {
unsafe.putLong(a, 0x0102030405060708L);
byte b = unsafe.getByte(a);
switch (b) {
case 0x01: byteOrder = ByteOrder.BIG_ENDIAN; break;
case 0x08: byteOrder = ByteOrder.LITTLE_ENDIAN; break;
default:
assert false;
}
} finally {
unsafe.freeMemory(a);
}
return byteOrder;
}
Returns the byte order of the underlying hardware. |
final byte getByte(int offset) {
return unsafe.getByte(offset + address);
}
Reads a byte starting at the given offset from base of this native
object. |
final char getChar(int offset) {
return unsafe.getChar(offset + address);
}
Reads a char starting at the given offset from base of this native
object. |
final double getDouble(int offset) {
return unsafe.getDouble(offset + address);
}
Reads a double starting at the given offset from base of this native
object. |
final float getFloat(int offset) {
return unsafe.getFloat(offset + address);
}
Reads a float starting at the given offset from base of this native
object. |
final int getInt(int offset) {
return unsafe.getInt(offset + address);
}
Reads an int starting at the given offset from base of this native
object. |
final long getLong(int offset) {
return unsafe.getLong(offset + address);
}
Reads a long starting at the given offset from base of this native
object. |
NativeObject getObject(int offset) {
long newAddress = 0L;
switch (addressSize()) {
case 8:
newAddress = unsafe.getLong(offset + address);
break;
case 4:
newAddress = unsafe.getInt(offset + address) & 0x00000000FFFFFFFF;
break;
default:
throw new InternalError("Address size not supported");
}
return new NativeObject(newAddress);
}
Reads an address from this native object at the given offset and
constructs a native object using that address. |
final short getShort(int offset) {
return unsafe.getShort(offset + address);
}
Reads a short starting at the given offset from base of this native
object. |
static int pageSize() {
if (pageSize == -1)
pageSize = unsafe.pageSize();
return pageSize;
}
Returns the page size of the underlying hardware. |
final void putByte(int offset,
byte value) {
unsafe.putByte(offset + address, value);
}
Writes a byte at the specified offset from this native object's
base address. |
final void putChar(int offset,
char value) {
unsafe.putChar(offset + address, value);
}
Writes a char at the specified offset from this native object's
base address. |
final void putDouble(int offset,
double value) {
unsafe.putDouble(offset + address, value);
}
Writes a double at the specified offset from this native object's
base address. |
final void putFloat(int offset,
float value) {
unsafe.putFloat(offset + address, value);
}
Writes a float at the specified offset from this native object's
base address. |
final void putInt(int offset,
int value) {
unsafe.putInt(offset + address, value);
}
Writes an int at the specified offset from this native object's
base address. |
final void putLong(int offset,
long value) {
unsafe.putLong(offset + address, value);
}
Writes a long at the specified offset from this native object's
base address. |
void putObject(int offset,
NativeObject ob) {
switch (addressSize()) {
case 8:
putLong(offset, ob.address);
break;
case 4:
putInt(offset, (int)(ob.address & 0x00000000FFFFFFFF));
break;
default:
throw new InternalError("Address size not supported");
}
}
Writes the base address of the given native object at the given offset
of this native object. |
final void putShort(int offset,
short value) {
unsafe.putShort(offset + address, value);
}
Writes a short at the specified offset from this native object's
base address. |
NativeObject subObject(int offset) {
return new NativeObject(offset + address);
}
Creates a new native object starting at the given offset from the base
of this native object. |