Package jnr.ffi
Class StructLayout
- java.lang.Object
-
- jnr.ffi.Type
-
- jnr.ffi.StructLayout
-
public class StructLayout extends Type
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description (package private) int
alignment
(package private) static java.nio.charset.Charset
ASCII
(package private) StructLayout
enclosing
private boolean
isUnion
(package private) int
offset
(package private) int
paddedSize
private boolean
resetIndex
private Runtime
runtime
(package private) int
size
(package private) static java.nio.charset.Charset
UTF8
-
Constructor Summary
Constructors Modifier Constructor Description protected
StructLayout(Runtime runtime)
Creates a new StructLayout.protected
StructLayout(Runtime runtime, int structSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
addField(int size, int align)
protected int
addField(int size, int align, StructLayout.Offset offset)
protected int
addField(Type t)
protected int
addField(Type t, StructLayout.Offset offset)
private static int
align(int offset, int alignment)
int
alignment()
The native alignment of this type, in bytesprotected <T extends StructLayout.Field>
T[]array(T[] array)
Creates an array of Member instances.protected void
arrayBegin()
Starts an array construction sessionprotected void
arrayEnd()
Ends an array construction sessionprotected StructLayout.Offset
at(int offset)
protected <T> StructLayout.Function<T>
function(java.lang.Class<T> closureClass)
protected <T> StructLayout.Function<T>
function(java.lang.Class<T> closureClass, StructLayout.Offset offset)
NativeType
getNativeType()
The native type of this typeRuntime
getRuntime()
protected <T extends StructLayout>
Tinner(T structLayout)
int
offset()
int
size()
The size in bytes of this type.java.lang.String
toString()
Returns a human readableString
representation of the structure.
-
-
-
Field Detail
-
ASCII
static final java.nio.charset.Charset ASCII
-
UTF8
static final java.nio.charset.Charset UTF8
-
runtime
private final Runtime runtime
-
isUnion
private final boolean isUnion
- See Also:
- Constant Field Values
-
resetIndex
private boolean resetIndex
-
enclosing
StructLayout enclosing
-
offset
int offset
-
size
int size
-
alignment
int alignment
-
paddedSize
int paddedSize
-
-
Method Detail
-
getRuntime
public final Runtime getRuntime()
-
size
public final int size()
Description copied from class:Type
The size in bytes of this type.
-
alignment
public final int alignment()
Description copied from class:Type
The native alignment of this type, in bytes
-
offset
public final int offset()
-
getNativeType
public NativeType getNativeType()
Description copied from class:Type
The native type of this type- Specified by:
getNativeType
in classType
- Returns:
- the native type of this type
-
toString
public java.lang.String toString()
Returns a human readableString
representation of the structure.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a
String
representation of this structure.
-
align
private static int align(int offset, int alignment)
-
addField
protected final int addField(int size, int align)
-
addField
protected final int addField(int size, int align, StructLayout.Offset offset)
-
addField
protected final int addField(Type t)
-
addField
protected final int addField(Type t, StructLayout.Offset offset)
-
at
protected final StructLayout.Offset at(int offset)
-
arrayBegin
protected final void arrayBegin()
Starts an array construction session
-
arrayEnd
protected final void arrayEnd()
Ends an array construction session
-
array
protected <T extends StructLayout.Field> T[] array(T[] array)
Creates an array of Member instances.- Type Parameters:
T
- The type of the Member subclass to create.- Parameters:
array
- the array to store the instances in- Returns:
- the array that was passed in
-
inner
protected final <T extends StructLayout> T inner(T structLayout)
-
function
protected final <T> StructLayout.Function<T> function(java.lang.Class<T> closureClass)
-
function
protected final <T> StructLayout.Function<T> function(java.lang.Class<T> closureClass, StructLayout.Offset offset)
-
-