Package jnr.ffi
Class NativeLong
- java.lang.Object
-
- java.lang.Number
-
- jnr.ffi.NativeLong
-
- All Implemented Interfaces:
Serializable,Comparable<NativeLong>
public final class NativeLong extends Number implements Comparable<NativeLong>
Represents a C long.In C, a long can be either 32 bits or 64bits, depending on the platform.
Replace any function parameters which are long in the C definition with a NativeLong.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NativeLong(int value)Creates a new NativeLong instance with the supplied value.NativeLong(long value)Creates a new NativeLong instance with the supplied value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(NativeLong other)Compares twoNativeLonginstances numerically.doubledoubleValue()Returns andoublerepresentation of this NativeLong.booleanequals(Object obj)Compares this NativeLong to another NativeLong.floatfloatValue()Returns anfloatrepresentation of this NativeLong.inthashCode()Gets a hash code for thisNativeLong.intintValue()Returns an integer representation of this NativeLong.longlongValue()Returns anlongrepresentation of this NativeLong.StringtoString()Returns a string representation of this NativeLong.static NativeLongvalueOf(int value)Returns a NativeLong instance representing the specified int valuestatic NativeLongvalueOf(long value)Returns a NativeLong instance representing the specified long value-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Method Detail
-
intValue
public final int intValue()
Returns an integer representation of this NativeLong.
-
longValue
public final long longValue()
Returns anlongrepresentation of this NativeLong.
-
floatValue
public final float floatValue()
Returns anfloatrepresentation of this NativeLong.- Specified by:
floatValuein classNumber- Returns:
- an
floatvalue for this NativeLong.
-
doubleValue
public final double doubleValue()
Returns andoublerepresentation of this NativeLong.- Specified by:
doubleValuein classNumber- Returns:
- an
doublevalue for this NativeLong.
-
hashCode
public final int hashCode()
Gets a hash code for thisNativeLong.
-
equals
public final boolean equals(Object obj)
Compares this NativeLong to another NativeLong.
-
toString
public String toString()
Returns a string representation of this NativeLong.
-
compareTo
public final int compareTo(NativeLong other)
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
public static NativeLong valueOf(long value)
Returns a NativeLong instance representing the specified long value- Parameters:
value- a long value- Returns:
- a NativeLong instance representing value
-
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 representing value
-
-