Package jnr.ffi
Class Struct.NumberField
- java.lang.Object
-
- jnr.ffi.Struct.Member
-
- jnr.ffi.Struct.NumberField
-
- Direct Known Subclasses:
Struct.Address
,Struct.Double
,Struct.EnumField
,Struct.Float
,Struct.IntegerAlias
,Struct.PointerField
,Struct.Signed16
,Struct.Signed32
,Struct.Signed64
,Struct.Signed8
,Struct.SignedLong
,Struct.Unsigned16
,Struct.Unsigned32
,Struct.Unsigned64
,Struct.Unsigned8
,Struct.UnsignedLong
- Enclosing class:
- Struct
public abstract class Struct.NumberField extends Struct.Member
Base class for all Number structure fields.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NumberField(NativeType type)
protected
NumberField(NativeType type, Struct.Offset offset)
protected
NumberField(TypeAlias type)
protected
NumberField(TypeAlias type, Struct.Offset offset)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description byte
byteValue()
Returns abyte
representation of thisNumber
.double
doubleValue()
Returns anfloat
representation of thisNumber
.float
floatValue()
Returns anfloat
representation of thisNumber
.Pointer
getMemory()
abstract int
intValue()
Returns aint
representation of thisNumber
.long
longValue()
Returns along
representation of thisNumber
.long
offset()
Gets the offset within the structure for this field.abstract void
set(java.lang.Number value)
Sets the field to a new value.short
shortValue()
Returns ashort
representation of thisNumber
.Struct
struct()
Gets theStruct
thisMember
is in.java.lang.String
toString()
Returns a string representation of thisNumber
.
-
-
-
Field Detail
-
type
protected final Type type
-
-
Constructor Detail
-
NumberField
protected NumberField(NativeType type)
-
NumberField
protected NumberField(NativeType type, Struct.Offset offset)
-
NumberField
protected NumberField(TypeAlias type)
-
NumberField
protected NumberField(TypeAlias type, Struct.Offset offset)
-
-
Method Detail
-
getMemory
public final Pointer getMemory()
-
struct
public final Struct struct()
Gets theStruct
thisMember
is in.- Returns:
- a
Struct
.
-
offset
public final long offset()
Gets the offset within the structure for this field.
-
set
public abstract void set(java.lang.Number value)
Sets the field to a new value.- Parameters:
value
- The new value.
-
doubleValue
public double doubleValue()
Returns anfloat
representation of thisNumber
.- Returns:
- an
float
value for thisNumber
.
-
floatValue
public float floatValue()
Returns anfloat
representation of thisNumber
.- Returns:
- an
float
value for thisNumber
.
-
byteValue
public byte byteValue()
Returns abyte
representation of thisNumber
.- Returns:
- a
byte
value for thisNumber
.
-
shortValue
public short shortValue()
Returns ashort
representation of thisNumber
.- Returns:
- a
short
value for thisNumber
.
-
intValue
public abstract int intValue()
Returns aint
representation of thisNumber
.- Returns:
- a
int
value for thisNumber
.
-
longValue
public long longValue()
Returns along
representation of thisNumber
.- Returns:
- a
long
value for thisNumber
.
-
toString
public java.lang.String toString()
Returns a string representation of thisNumber
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this
Number
.
-
-