Package jnr.ffi
Class StructLayout
- java.lang.Object
-
- jnr.ffi.Type
-
- jnr.ffi.StructLayout
-
public class StructLayout extends Type
-
-
Nested Class Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
StructLayout(Runtime runtime)
Creates a newStructLayout
.protected
StructLayout(Runtime runtime, int structSize)
-
Method Summary
All 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)
int
alignment()
The native alignment of this type, in bytesprotected <T extends StructLayout.Field>
T[]array(T[] array)
Creates an array ofMember
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.
-
-
-
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.
-
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 ofMember
instances.- Type Parameters:
T
- The type of theMember
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)
-
-