Package jnr.ffi
Class NativeLong
java.lang.Object
java.lang.Number
jnr.ffi.NativeLong
- All Implemented Interfaces:
Serializable
,Comparable<NativeLong>
Represents a C long.
In C, a long
can be either 32 bits or 64bits, depending on the platform.
long
in the C definition with
a NativeLong.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Internal cache of common native long values -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final NativeLong
private static final NativeLong
private final long
private static final NativeLong
-
Constructor Summary
ConstructorsConstructorDescriptionNativeLong
(int value) Creates a newNativeLong
instance with the supplied value.NativeLong
(long value) Creates a newNativeLong
instance with the supplied value. -
Method Summary
Modifier and TypeMethodDescriptionprivate static NativeLong
_valueOf
(int value) private static NativeLong
_valueOf
(long value) final int
compareTo
(NativeLong other) Compares twoNativeLong
instances numerically.final double
Returns andouble
representation of thisNativeLong
.final boolean
Compares thisNativeLong
to anotherNativeLong
.final float
Returns anfloat
representation of thisNativeLong
.final int
hashCode()
Gets a hash code for thisNativeLong
.final int
intValue()
Returns an integer representation of thisNativeLong
.final long
Returns anlong
representation of thisNativeLong
.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 valueMethods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
ZERO
-
ONE
-
MINUS_ONE
-
value
private final long value
-
-
Constructor Details
-
NativeLong
public NativeLong(long value) Creates a newNativeLong
instance with the supplied value.- Parameters:
value
- a long or integer.
-
NativeLong
public NativeLong(int value) Creates a newNativeLong
instance with the supplied value.- Parameters:
value
- an integer.
-
-
Method Details
-
intValue
public final int intValue()Returns an integer representation of thisNativeLong
. -
longValue
public final long longValue()Returns anlong
representation of thisNativeLong
. -
floatValue
public final float floatValue()Returns anfloat
representation of thisNativeLong
.- Specified by:
floatValue
in classNumber
- Returns:
- an
float
value for thisNativeLong
.
-
doubleValue
public final double doubleValue()Returns andouble
representation of thisNativeLong
.- Specified by:
doubleValue
in classNumber
- Returns:
- an
double
value for thisNativeLong
.
-
hashCode
public final int hashCode()Gets a hash code for thisNativeLong
. -
equals
Compares thisNativeLong
to anotherNativeLong
. -
toString
Returns a string representation of thisNativeLong
. -
compareTo
Compares twoNativeLong
instances numerically.- Specified by:
compareTo
in interfaceComparable<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
-
_valueOf
-
valueOf
Returns a NativeLong instance representing the specified long value- Parameters:
value
- a long value- Returns:
- a
NativeLong
instance representingvalue
-
valueOf
Returns a NativeLong instance representing the specified int value- Parameters:
value
- a 32bit integer value- Returns:
- a
NativeLong
instance representingvalue
-