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:
-
Constructor Summary
ConstructorsConstructorDescriptionNativeLong(int value) Creates a newNativeLonginstance with the supplied value.NativeLong(long value) Creates a newNativeLonginstance with the supplied value. -
Method Summary
Modifier and TypeMethodDescriptionfinal intcompareTo(NativeLong other) Compares twoNativeLonginstances numerically.final doubleReturns andoublerepresentation of thisNativeLong.final booleanCompares thisNativeLongto anotherNativeLong.final floatReturns anfloatrepresentation of thisNativeLong.final inthashCode()Gets a hash code for thisNativeLong.final intintValue()Returns an integer representation of thisNativeLong.final longReturns anlongrepresentation of thisNativeLong.toString()Returns a string representation of thisNativeLong.static NativeLongvalueOf(int value) Returns a NativeLong instance representing the specified int valuestatic NativeLongvalueOf(long value) Returns a NativeLong instance representing the specified long valueMethods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
NativeLong
public NativeLong(long value) Creates a newNativeLonginstance with the supplied value.- Parameters:
value- a long or integer.
-
NativeLong
public NativeLong(int value) Creates a newNativeLonginstance 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 anlongrepresentation of thisNativeLong. -
floatValue
public final float floatValue()Returns anfloatrepresentation of thisNativeLong.- Specified by:
floatValuein classNumber- Returns:
- an
floatvalue for thisNativeLong.
-
doubleValue
public final double doubleValue()Returns andoublerepresentation of thisNativeLong.- Specified by:
doubleValuein classNumber- Returns:
- an
doublevalue for thisNativeLong.
-
hashCode
public final int hashCode()Gets a hash code for thisNativeLong. -
equals
Compares thisNativeLongto anotherNativeLong. -
toString
Returns a string representation of thisNativeLong. -
compareTo
Compares twoNativeLonginstances numerically.- Specified by:
compareToin interfaceComparable<NativeLong>- Parameters:
other- the other NativeLong to compare to.- Returns:
0ifotheris equal to this instance, -1 if this instance is numerically less thanotheror 1 if this instance is numerically greater thanother.
-
valueOf
Returns a NativeLong instance representing the specified long value- Parameters:
value- a long value- Returns:
- a
NativeLonginstance representingvalue
-
valueOf
Returns a NativeLong instance representing the specified int value- Parameters:
value- a 32bit integer value- Returns:
- a
NativeLonginstance representingvalue
-