Package jnr.ffi
Class NativeLong
- java.lang.Object
-
- java.lang.Number
-
- jnr.ffi.NativeLong
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<NativeLong>
public final class NativeLong extends java.lang.Number implements java.lang.Comparable<NativeLong>
Represents a C long.In C, a
Replace any function parameters which arelong
can be either 32 bits or 64bits, depending on the platform.long
in the C definition with a NativeLong.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NativeLong(int value)
Creates a newNativeLong
instance with the supplied value.NativeLong(long value)
Creates a newNativeLong
instance with the supplied value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(NativeLong other)
Compares twoNativeLong
instances numerically.double
doubleValue()
Returns andouble
representation of thisNativeLong
.boolean
equals(java.lang.Object obj)
Compares thisNativeLong
to anotherNativeLong
.float
floatValue()
Returns anfloat
representation of thisNativeLong
.int
hashCode()
Gets a hash code for thisNativeLong
.int
intValue()
Returns an integer representation of thisNativeLong
.long
longValue()
Returns anlong
representation of thisNativeLong
.java.lang.String
toString()
Returns a string representation of thisNativeLong
.static NativeLong
valueOf(int value)
Returns a NativeLong instance representing the specified int valuestatic NativeLong
valueOf(long value)
Returns a NativeLong instance representing the specified long value
-
-
-
Method Detail
-
intValue
public final int intValue()
Returns an integer representation of thisNativeLong
.- Specified by:
intValue
in classjava.lang.Number
- Returns:
- an integer value for this
NativeLong
.
-
longValue
public final long longValue()
Returns anlong
representation of thisNativeLong
.- Specified by:
longValue
in classjava.lang.Number
- Returns:
- an
long
value for thisNativeLong
.
-
floatValue
public final float floatValue()
Returns anfloat
representation of thisNativeLong
.- Specified by:
floatValue
in classjava.lang.Number
- Returns:
- an
float
value for thisNativeLong
.
-
doubleValue
public final double doubleValue()
Returns andouble
representation of thisNativeLong
.- Specified by:
doubleValue
in classjava.lang.Number
- Returns:
- an
double
value for thisNativeLong
.
-
hashCode
public final int hashCode()
Gets a hash code for thisNativeLong
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this
NativeLong
.
-
equals
public final boolean equals(java.lang.Object obj)
Compares thisNativeLong
to anotherNativeLong
.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the otherNativeLong
to compare to.- Returns:
true
if thisNativeLong
is equal to the otherNativeLong
, else false.
-
toString
public java.lang.String toString()
Returns a string representation of thisNativeLong
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this
NativeLong
.
-
compareTo
public final int compareTo(NativeLong other)
Compares twoNativeLong
instances numerically.- Specified by:
compareTo
in interfacejava.lang.Comparable<NativeLong>
- Parameters:
other
- the other NativeLong to compare to.- Returns:
0
ifother
is equal to this instance, -1 if this instance is numerically less thanother
or 1 if this instance is numerically greater thanother
.
-
valueOf
public static NativeLong valueOf(long value)
Returns a NativeLong instance representing the specified long value- Parameters:
value
- a long value- Returns:
- a
NativeLong
instance representingvalue
-
valueOf
public static NativeLong valueOf(int value)
Returns a NativeLong instance representing the specified int value- Parameters:
value
- a 32bit integer value- Returns:
- a
NativeLong
instance representingvalue
-
-