public class StructLayout extends Type
Modifier and Type | Field and 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 |
Modifier | Constructor and Description |
---|---|
protected |
StructLayout(Runtime runtime)
Creates a new StructLayout.
|
protected |
StructLayout(Runtime runtime,
int structSize) |
Modifier and Type | Method and 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 bytes
|
protected <T extends StructLayout.Field> |
array(T[] array)
Creates an array of Member instances.
|
protected void |
arrayBegin()
Starts an array construction session
|
protected void |
arrayEnd()
Ends an array construction session
|
protected 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 type
|
Runtime |
getRuntime() |
protected <T extends StructLayout> |
inner(T structLayout) |
int |
offset() |
int |
size()
The size in bytes of this type.
|
java.lang.String |
toString()
Returns a human readable
String representation of the structure. |
static final java.nio.charset.Charset ASCII
static final java.nio.charset.Charset UTF8
private final Runtime runtime
private final boolean isUnion
private boolean resetIndex
StructLayout enclosing
int offset
int size
int alignment
int paddedSize
protected StructLayout(Runtime runtime)
runtime
- The current runtime.protected StructLayout(Runtime runtime, int structSize)
public final Runtime getRuntime()
public final int size()
Type
public final int alignment()
Type
public final int offset()
public NativeType getNativeType()
Type
getNativeType
in class Type
public java.lang.String toString()
String
representation of the structure.toString
in class java.lang.Object
String
representation of this structure.private static int align(int offset, int alignment)
protected final int addField(int size, int align)
protected final int addField(int size, int align, StructLayout.Offset offset)
protected final int addField(Type t)
protected final int addField(Type t, StructLayout.Offset offset)
protected final StructLayout.Offset at(int offset)
protected final void arrayBegin()
protected final void arrayEnd()
protected <T extends StructLayout.Field> T[] array(T[] array)
T
- The type of the Member subclass to create.array
- the array to store the instances inprotected final <T extends StructLayout> T inner(T structLayout)
protected final <T> StructLayout.Function<T> function(java.lang.Class<T> closureClass)
protected final <T> StructLayout.Function<T> function(java.lang.Class<T> closureClass, StructLayout.Offset offset)