|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
jnr.ffi.Address
public final class Address
The 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 Summary | |
|---|---|
Address(Address address)
Creates a new address representation. |
|
| Method Summary | |
|---|---|
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(java.lang.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. |
java.lang.String |
toHexString()
Returns a String object representing this Address as a hex value. |
java.lang.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. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Address(Address address)
address - the native address.| Method Detail |
|---|
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.
intValue in class java.lang.NumberAddress after conversion to an int.public final long longValue()
Address as a long.
longValue in class java.lang.NumberAddress after conversion to 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 java.lang.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 java.lang.NumberAddress after conversion to a double.public final long nativeAddress()
long value representing the native value of this address.public final int hashCode()
Address.
hashCode in class java.lang.ObjectAddress.public final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the other address to compare to.
true if this Address is equal to the other address, else false.public final java.lang.String toString()
String object representing this Address as a decimal value.
toString in class java.lang.ObjectAddress.public final java.lang.String toHexString()
String object representing this Address as a hex value.
Address.public final int compareTo(Address other)
Address instances numerically.
compareTo in interface java.lang.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 value
Address instance representing addresspublic static Address valueOf(int address)
int value.
address - an int value
Address instance representing address
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||