Top Description Inners Fields Constructors Methods
com.kenai.jffi

public abstract Class Type

extends Object
Class Inheritance
Known Direct Subclasses
com.kenai.jffi.Type.Builtin, com.kenai.jffi.Aggregate
Imports
java.util.List

Native parameter and return types.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Type.Builtin

Types that are built-in to libffi.

pack-priv static class
Type.TypeInfo

This is a lazy loaded cache of builtin type info, so we can still have Type.VOID as a public static variable without it causing the native library to load.

Field Summary

Modifier and TypeField and Description
private int
public static final Type
DOUBLE

The native double type

public static final Type
FLOAT

The native float type

private volatile long
public static final Type
LONGDOUBLE

The native long double type

public static final Type
POINTER

The native memory address type

public static final Type
SCHAR

The native signed char type

public static final Type
SINT

The native signed integer type

public static final Type
SINT16

The native signed 16 bit integer type

public static final Type
SINT32

The native signed 32 bit integer type

public static final Type
SINT64

The native signed 64 bit integer type

public static final Type
SINT8

The native signed 8 bit integer type

private int
public static final Type
SLONG

The native signed long integer type

public static final Type
SLONG_LONG

The native signed long long integer type

public static final Type
SSHORT

The native signed short integer type

private int
public static final Type
UCHAR

The native unsigned char type

public static final Type
UINT

The native unsigned integer type

public static final Type
UINT16

The native unsigned 16 bit integer type

public static final Type
UINT32

The native unsigned 32 bit integer type

public static final Type
UINT64

The native unsigned 64 bit integer type

public static final Type
UINT8

The native unsigned 8 bit integer type

public static final Type
ULONG

The native unsigned long integer type

public static final Type
ULONG_LONG

The native unsigned long long integer type

public static final Type
USHORT

The native unsigned short integer type

public static final Type
VOID

The native void type

Constructor Summary

AccessConstructor and Description
public
Type()

Method Summary

Modifier and TypeMethod and Description
public final int

Returns:

The alignment of this type, in bytes.
alignment
()

Gets the alignment of this type.

private static Type

Returns:

A Type instance.
builtin
(NativeType
The builtin type enum.
nativeType
)

Creates a Type instance for builtin types.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
pack-priv abstract Type.TypeInfo
pack-priv final long

Returns:

The address of the ffi_type structure
handle
()

Gets the native address of the ffi_type struct for this Type

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
pack-priv static long[]

Returns:

An array of native ffi_type handles.
nativeHandles
(Type[]
An array of Type objects
types
)

Converts an array of Type objects into an array of pointers to ffi_type structures.

pack-priv static long[]

Returns:

An array of native ffi_type handles.
nativeHandles
(List<Type>
A list of Type objects
types
)

Converts a list of Type objects into an array of pointers to ffi_type structures.

private int
private long
private int
private int
public final int

Returns:

The size of this type, in bytes.
size
()

Gets the size of this type.

public final int

Returns:

An integer representing the FFI type.
type
()

Gets the FFI type enum value for this Type

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

alignmentback to summary
private int alignment
DOUBLEback to summary
public static final Type DOUBLE

The native double type

FLOATback to summary
public static final Type FLOAT

The native float type

handleback to summary
private volatile long handle
LONGDOUBLEback to summary
public static final Type LONGDOUBLE

The native long double type

POINTERback to summary
public static final Type POINTER

The native memory address type

SCHARback to summary
public static final Type SCHAR

The native signed char type

SINTback to summary
public static final Type SINT

The native signed integer type

SINT16back to summary
public static final Type SINT16

The native signed 16 bit integer type

SINT32back to summary
public static final Type SINT32

The native signed 32 bit integer type

SINT64back to summary
public static final Type SINT64

The native signed 64 bit integer type

SINT8back to summary
public static final Type SINT8

The native signed 8 bit integer type

sizeback to summary
private int size
SLONGback to summary
public static final Type SLONG

The native signed long integer type

SLONG_LONGback to summary
public static final Type SLONG_LONG

The native signed long long integer type

SSHORTback to summary
public static final Type SSHORT

The native signed short integer type

typeback to summary
private int type
UCHARback to summary
public static final Type UCHAR

The native unsigned char type

UINTback to summary
public static final Type UINT

The native unsigned integer type

UINT16back to summary
public static final Type UINT16

The native unsigned 16 bit integer type

UINT32back to summary
public static final Type UINT32

The native unsigned 32 bit integer type

UINT64back to summary
public static final Type UINT64

The native unsigned 64 bit integer type

UINT8back to summary
public static final Type UINT8

The native unsigned 8 bit integer type

ULONGback to summary
public static final Type ULONG

The native unsigned long integer type

ULONG_LONGback to summary
public static final Type ULONG_LONG

The native unsigned long long integer type

USHORTback to summary
public static final Type USHORT

The native unsigned short integer type

VOIDback to summary
public static final Type VOID

The native void type

Constructor Detail

Typeback to summary
public Type()

Method Detail

alignmentback to summary
public final int alignment()

Gets the alignment of this type.

Returns:int

The alignment of this type, in bytes.

builtinback to summary
private static Type builtin(NativeType nativeType)

Creates a Type instance for builtin types.

Parameters
nativeType:NativeType

The builtin type enum.

Returns:Type

A Type instance.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getTypeInfoback to summary
pack-priv abstract Type.TypeInfo getTypeInfo()
handleback to summary
pack-priv final long handle()

Gets the native address of the ffi_type struct for this Type

Returns:long

The address of the ffi_type structure

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
nativeHandlesback to summary
pack-priv static long[] nativeHandles(Type[] types)

Converts an array of Type objects into an array of pointers to ffi_type structures.

Parameters
types:Type[]

An array of Type objects

Returns:long[]

An array of native ffi_type handles.

nativeHandlesback to summary
pack-priv static long[] nativeHandles(List<Type> types)

Converts a list of Type objects into an array of pointers to ffi_type structures.

Parameters
types:List<Type>

A list of Type objects

Returns:long[]

An array of native ffi_type handles.

resolveAlignmentback to summary
private int resolveAlignment()
resolveHandleback to summary
private long resolveHandle()
resolveSizeback to summary
private int resolveSize()
resolveTypeback to summary
private int resolveType()
sizeback to summary
public final int size()

Gets the size of this type.

Returns:int

The size of this type, in bytes.

typeback to summary
public final int type()

Gets the FFI type enum value for this Type

Returns:int

An integer representing the FFI type.

com.kenai.jffi back to summary

pack-priv final Class Type.Builtin

extends Type
Class Inheritance

Types that are built-in to libffi.

Field Summary

Modifier and TypeField and Description
private final NativeType
private Type.TypeInfo
Inherited from com.kenai.jffi.Type:
DOUBLEFLOATLONGDOUBLEPOINTERSCHARSINTSINT16SINT32SINT64SINT8SLONGSLONG_LONGSSHORTUCHARUINTUINT16UINT32UINT64UINT8ULONGULONG_LONGUSHORTVOID

Constructor Summary

AccessConstructor and Description
private
Builtin(NativeType nativeType)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides com.kenai.jffi.Type.equals.

Indicates whether some other object is "equal to" this one.
pack-priv Type.TypeInfo
public int
hashCode()

Overrides com.kenai.jffi.Type.hashCode.

Returns a hash code value for this object.
private Type.TypeInfo
Inherited from com.kenai.jffi.Type:
alignmenthandlenativeHandlesnativeHandlessizetype

Field Detail

nativeTypeback to summary
private final NativeType nativeType
typeInfoback to summary
private Type.TypeInfo typeInfo

Constructor Detail

Builtinback to summary
private Builtin(NativeType nativeType)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides com.kenai.jffi.Type.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getTypeInfoback to summary
pack-priv Type.TypeInfo getTypeInfo()

Implements abstract com.kenai.jffi.Type.getTypeInfo.

hashCodeback to summary
public int hashCode()

Overrides com.kenai.jffi.Type.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
lookupTypeInfoback to summary
private Type.TypeInfo lookupTypeInfo()
com.kenai.jffi back to summary

pack-priv final Class Type.TypeInfo

extends Object
Class Inheritance

This is a lazy loaded cache of builtin type info, so we can still have Type.VOID as a public static variable without it causing the native library to load.

Field Summary

Modifier and TypeField and Description
pack-priv final int
alignment

The minimum alignment of this type

pack-priv final long
handle

The address of this type's ffi_type structure

pack-priv final int
size

The size in bytes of this type

pack-priv final int
type

The FFI type of this type

Constructor Summary

AccessConstructor and Description
pack-priv
TypeInfo(long handle, int type, int size, int alignment)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alignmentback to summary
pack-priv final int alignment

The minimum alignment of this type

handleback to summary
pack-priv final long handle

The address of this type's ffi_type structure

sizeback to summary
pack-priv final int size

The size in bytes of this type

typeback to summary
pack-priv final int type

The FFI type of this type

Constructor Detail

TypeInfoback to summary
pack-priv TypeInfo(long handle, int type, int size, int alignment)