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 arelongcan be either 32 bits or 64bits, depending on the platform.longin the C definition with a NativeLong.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNativeLong.CacheInternal cache of common native long values
-
Field Summary
Fields Modifier and Type Field Description private static NativeLongMINUS_ONEprivate static NativeLongONEprivate longvalueprivate static NativeLongZERO
-
Constructor Summary
Constructors Constructor Description NativeLong(int value)Creates a newNativeLonginstance with the supplied value.NativeLong(long value)Creates a newNativeLonginstance with the supplied value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static NativeLong_valueOf(int value)private static NativeLong_valueOf(long value)intcompareTo(NativeLong other)Compares twoNativeLonginstances numerically.doubledoubleValue()Returns andoublerepresentation of thisNativeLong.booleanequals(java.lang.Object obj)Compares thisNativeLongto anotherNativeLong.floatfloatValue()Returns anfloatrepresentation of thisNativeLong.inthashCode()Gets a hash code for thisNativeLong.intintValue()Returns an integer representation of thisNativeLong.longlongValue()Returns anlongrepresentation of thisNativeLong.java.lang.StringtoString()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 value
-
-
-
Field Detail
-
ZERO
private static final NativeLong ZERO
-
ONE
private static final NativeLong ONE
-
MINUS_ONE
private static final NativeLong MINUS_ONE
-
value
private final long value
-
-
Method Detail
-
intValue
public final int intValue()
Returns an integer representation of thisNativeLong.- Specified by:
intValuein classjava.lang.Number- Returns:
- an integer value for this
NativeLong.
-
longValue
public final long longValue()
Returns anlongrepresentation of thisNativeLong.- Specified by:
longValuein classjava.lang.Number- Returns:
- an
longvalue for thisNativeLong.
-
floatValue
public final float floatValue()
Returns anfloatrepresentation of thisNativeLong.- Specified by:
floatValuein classjava.lang.Number- Returns:
- an
floatvalue for thisNativeLong.
-
doubleValue
public final double doubleValue()
Returns andoublerepresentation of thisNativeLong.- Specified by:
doubleValuein classjava.lang.Number- Returns:
- an
doublevalue for thisNativeLong.
-
hashCode
public final int hashCode()
Gets a hash code for thisNativeLong.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code for this
NativeLong.
-
equals
public final boolean equals(java.lang.Object obj)
Compares thisNativeLongto anotherNativeLong.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the otherNativeLongto compare to.- Returns:
trueif thisNativeLongis equal to the otherNativeLong, else false.
-
toString
public java.lang.String toString()
Returns a string representation of thisNativeLong.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this
NativeLong.
-
compareTo
public final int compareTo(NativeLong other)
Compares twoNativeLonginstances numerically.- Specified by:
compareToin interfacejava.lang.Comparable<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
private static NativeLong _valueOf(long value)
-
_valueOf
private static NativeLong _valueOf(int value)
-
valueOf
public static NativeLong valueOf(long value)
Returns a NativeLong instance representing the specified long value- Parameters:
value- a long value- Returns:
- a
NativeLonginstance 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
NativeLonginstance representingvalue
-
-