jnr.ffi
Class StructLayout

java.lang.Object
  extended by jnr.ffi.Type
      extended by jnr.ffi.StructLayout

public class StructLayout
extends Type


Nested Class Summary
protected  class StructLayout.AbstractBoolean
          Base class for Boolean fields
protected  class StructLayout.AbstractField
          Base implementation of Member
 class StructLayout.AsciiString
           
 class StructLayout.AsciiStringRef
           
 class StructLayout.blkcnt_t
           
 class StructLayout.blksize_t
           
protected  class StructLayout.Boolean
          A normal C boolean - 1 byte in size
 class StructLayout.caddr_t
           
 class StructLayout.clock_t
           
 class StructLayout.dev_t
           
 class StructLayout.Double
           
 class StructLayout.Enum<T extends Enum<T>>
           
 class StructLayout.Enum16<E extends Enum<E>>
           
 class StructLayout.Enum32<E extends Enum<E>>
           
 class StructLayout.Enum64<E extends Enum<E>>
           
 class StructLayout.Enum8<E extends Enum<E>>
          An 8 bit enum field.
protected  class StructLayout.EnumField<E extends Enum<E>>
          Base for all the Enum fields.
 class StructLayout.EnumLong<E extends Enum<E>>
           
protected  class StructLayout.Field
          Interface all Struct members must implement.
 class StructLayout.Float
           
 class StructLayout.fsblkcnt_t
           
 class StructLayout.fsfilcnt_t
           
 class StructLayout.gid_t
           
 class StructLayout.id_t
           
 class StructLayout.in_addr_t
           
 class StructLayout.in_port_t
           
 class StructLayout.ino_t
           
 class StructLayout.ino64_t
           
 class StructLayout.int16_t
           
 class StructLayout.int32_t
           
 class StructLayout.int64_t
           
 class StructLayout.int8_t
           
 class StructLayout.IntegerAlias
           
 class StructLayout.intptr_t
           
 class StructLayout.key_t
           
 class StructLayout.mode_t
           
 class StructLayout.nlink_t
           
protected  class StructLayout.NumberField
          Base class for all Number structure fields.
 class StructLayout.off_t
           
protected  class StructLayout.Padding
          Specialized padding fields for structs.
 class StructLayout.pid_t
           
 class StructLayout.Pointer
          Represents a native memory address.
 class StructLayout.rlim_t
           
 class StructLayout.sa_family_t
           
 class StructLayout.Signed16
          A 16 bit signed integer field.
 class StructLayout.Signed32
          A 32 bit signed integer field.
 class StructLayout.Signed64
          A 64 bit signed integer field.
 class StructLayout.Signed8
          An 8 bit signed integer
 class StructLayout.SignedLong
          A native long integer field.
 class StructLayout.size_t
           
 class StructLayout.socklen_t
           
 class StructLayout.ssize_t
           
 class StructLayout.String
           
 class StructLayout.swblk_t
           
 class StructLayout.time_t
           
 class StructLayout.u_int16_t
           
 class StructLayout.u_int32_t
           
 class StructLayout.u_int64_t
           
 class StructLayout.u_int8_t
           
 class StructLayout.uid_t
           
 class StructLayout.uintptr_t
           
 class StructLayout.Unsigned16
          A 16 bit signed integer field.
 class StructLayout.Unsigned32
          A 32 bit signed integer field.
 class StructLayout.Unsigned64
          A 64 bit unsigned integer field.
 class StructLayout.Unsigned8
          An 8 bit unsigned integer
 class StructLayout.UnsignedLong
          A native long integer field.
 class StructLayout.UTF8String
           
 class StructLayout.UTF8StringRef
           
 class StructLayout.UTFString
           
 class StructLayout.UTFStringRef
           
protected  class StructLayout.WBOOL
          A Windows BOOL - 4 bytes
 
Constructor Summary
protected StructLayout(Runtime runtime)
          Creates a new StructLayout.
 
Method Summary
protected  int addField(int size, int align)
           
protected  int addField(int size, int align, Struct.Offset offset)
           
protected  int addField(Type t)
           
protected  int addField(Type t, Struct.Offset offset)
           
 int alignment()
          The native alignment of this type, in bytes
protected
<T extends StructLayout.Field>
T[]
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
 NativeType getNativeType()
          The native type of this type
 Runtime getRuntime()
           
protected
<T extends StructLayout>
T
inner(T structLayout)
           
 int offset()
           
 int size()
          The size in bytes of this type.
 String toString()
          Returns a human readable String representation of the structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StructLayout

protected StructLayout(Runtime runtime)
Creates a new StructLayout.

Method Detail

getRuntime

public final Runtime getRuntime()

size

public final int size()
Description copied from class: Type
The size in bytes of this type.

Specified by:
size in class Type
Returns:
An integer

alignment

public final int alignment()
Description copied from class: Type
The native alignment of this type, in bytes

Specified by:
alignment in class Type
Returns:
An integer

offset

public final int offset()

getNativeType

public NativeType getNativeType()
Description copied from class: Type
The native type of this type

Specified by:
getNativeType in class Type
Returns:
the native type of this type

toString

public String toString()
Returns a human readable String representation of the structure.

Overrides:
toString in class 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,
                             Struct.Offset offset)

addField

protected final int addField(Type t)

addField

protected final int addField(Type t,
                             Struct.Offset 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)


Copyright © 2012. All Rights Reserved.