public final class Address extends Number implements Comparable<Address>
Address class wraps a native address in an object. Both 32 bit and 64
bit native address values are wrapped in a singular Address type.
This class extends Number and implements all Number methods for
converting to primitive integer types.
An Address instance is lighter weight than most Pointer
instances, and may be used when a native address needs to be stored in java,
but no other operations (such as reading/writing values) need be performed on
the native memory. For most cases, a Pointer offers more flexibility
and should be preferred instead.
| Constructor and Description |
|---|
Address(Address address)
Creates a new address representation.
|
| Modifier and Type | Method and Description |
|---|---|
long |
address()
Gets the native memory address represented by this
Address as a long integer. |
int |
compareTo(Address other)
Compares two
Address instances numerically. |
double |
doubleValue()
Returns the value of this
Address as a double. |
boolean |
equals(Object obj)
Compares this address to another address.
|
float |
floatValue()
Returns the value of this
Address as a float. |
int |
hashCode()
Returns a hash code for this
Address. |
int |
intValue()
Returns the value of this
Address as an int. |
boolean |
isNull()
Tests if this Address is equivalent to C NULL
|
long |
longValue()
Returns the value of this
Address as a long. |
long |
nativeAddress()
Returns the native value of this address.
|
String |
toHexString()
Returns a
String object representing this Address as a hex value. |
String |
toString()
Returns a
String object representing this Address as a decimal value. |
static Address |
valueOf(int address)
Returns a Address instance representing the specified
int value. |
static Address |
valueOf(long address)
Returns a Address instance representing the specified
long value. |
byteValue, shortValuepublic Address(Address address)
address - the native address.public final long address()
Address as a long integer.public final int intValue()
Address as an int.
On 64bit systems, this will result in the upper 32bits of the address being truncated.public final long longValue()
Address as a long.public final float floatValue()
Address as a float.
This method is not particularly useful, and is here to fulfill the Number interface contract.floatValue in class NumberAddress after conversion to a float.public final double doubleValue()
Address as a double.
This method is not particularly useful, and is here to fulfill the Number interface contract.doubleValue in class NumberAddress after conversion to a double.public final long nativeAddress()
long value representing the native value of this address.public final int hashCode()
Address.public final boolean equals(Object obj)
public final String toString()
String object representing this Address as a decimal value.public final String toHexString()
String object representing this Address as a hex value.Address.public final int compareTo(Address other)
Address instances numerically.compareTo in interface Comparable<Address>other - the other Address to compare to.0 if other is equal to this instance, -1 if this
instance is numerically less than other or 1 if this instance is
numerically greater than other.public final boolean isNull()
public static Address valueOf(long address)
long value.address - a long valueAddress instance representing addresspublic static Address valueOf(int address)
int value.address - an int valueAddress instance representing addressCopyright © 2017. All rights reserved.