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
Base class for all Number structure fields.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
NumberField
(NativeType type) protected
NumberField
(NativeType type, Struct.Offset offset) protected
NumberField
(TypeAlias type) protected
NumberField
(TypeAlias type, Struct.Offset offset) -
Method Summary
Modifier and TypeMethodDescriptionbyte
Returns abyte
representation of thisNumber
.double
Returns anfloat
representation of thisNumber
.float
Returns anfloat
representation of thisNumber
.final Pointer
Gets the memory object used to store thisMember
abstract int
intValue()
Returns aint
representation of thisNumber
.long
Returns along
representation of thisNumber
.final long
offset()
Gets the offset within the structure for this field.abstract void
Sets the field to a new value.short
Returns ashort
representation of thisNumber
.final Struct
struct()
Gets theStruct
thisMember
is in.toString()
Returns a string representation of thisNumber
.
-
Field Details
-
offset
private final int offsetOffset from the start of theStruct
memory this field is located at. -
type
-
-
Constructor Details
-
NumberField
-
NumberField
-
NumberField
-
NumberField
-
-
Method Details
-
getMemory
Description copied from class:Struct.Member
Gets the memory object used to store thisMember
- Specified by:
getMemory
in classStruct.Member
- Returns:
- a
Pointer
-
struct
Gets theStruct
thisMember
is in.- Specified by:
struct
in classStruct.Member
- Returns:
- a
Struct
.
-
offset
public final long offset()Gets the offset within the structure for this field.- Specified by:
offset
in classStruct.Member
- Returns:
- the offset within the structure for this field.
-
set
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
Returns a string representation of thisNumber
.
-