Package com.kenai.jffi
Class Type
- java.lang.Object
-
- com.kenai.jffi.Type
-
- Direct Known Subclasses:
Aggregate
,Type.Builtin
public abstract class Type extends java.lang.Object
Native parameter and return types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Type.Builtin
Types that are built-in to libffi.(package private) 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
Fields Modifier and Type Field Description private int
alignment
static Type
DOUBLE
The native double typestatic Type
FLOAT
The native float typeprivate long
handle
static Type
LONGDOUBLE
The native long double typestatic Type
POINTER
The native memory address typestatic Type
SCHAR
The native signed char typestatic Type
SINT
The native signed integer typestatic Type
SINT16
The native signed 16 bit integer typestatic Type
SINT32
The native signed 32 bit integer typestatic Type
SINT64
The native signed 64 bit integer typestatic Type
SINT8
The native signed 8 bit integer typeprivate int
size
static Type
SLONG
The native signed long integer typestatic Type
SLONG_LONG
The native signed long long integer typestatic Type
SSHORT
The native signed short integer typeprivate int
type
static Type
UCHAR
The native unsigned char typestatic Type
UINT
The native unsigned integer typestatic Type
UINT16
The native unsigned 16 bit integer typestatic Type
UINT32
The native unsigned 32 bit integer typestatic Type
UINT64
The native unsigned 64 bit integer typestatic Type
UINT8
The native unsigned 8 bit integer typestatic Type
ULONG
The native unsigned long integer typestatic Type
ULONG_LONG
The native unsigned long long integer typestatic Type
USHORT
The native unsigned short integer typestatic Type
VOID
The native void type
-
Constructor Summary
Constructors Constructor Description Type()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
alignment()
Gets the alignment of this type.private static Type
builtin(NativeType nativeType)
Creates aType
instance for builtin types.boolean
equals(java.lang.Object obj)
(package private) abstract Type.TypeInfo
getTypeInfo()
(package private) long
handle()
Gets the native address of the ffi_type struct for thisType
int
hashCode()
(package private) static long[]
nativeHandles(Type[] types)
Converts an array ofType
objects into an array of pointers to ffi_type structures.(package private) static long[]
nativeHandles(java.util.List<Type> types)
Converts a list ofType
objects into an array of pointers to ffi_type structures.private int
resolveAlignment()
private long
resolveHandle()
private int
resolveSize()
private int
resolveType()
int
size()
Gets the size of this type.int
type()
Gets the FFI type enum value for thisType
-
-
-
Field Detail
-
VOID
public static final Type VOID
The native void type
-
FLOAT
public static final Type FLOAT
The native float type
-
DOUBLE
public static final Type DOUBLE
The native double type
-
LONGDOUBLE
public static final Type LONGDOUBLE
The native long double type
-
UINT8
public static final Type UINT8
The native unsigned 8 bit integer type
-
SINT8
public static final Type SINT8
The native signed 8 bit integer type
-
UINT16
public static final Type UINT16
The native unsigned 16 bit integer type
-
SINT16
public static final Type SINT16
The native signed 16 bit integer type
-
UINT32
public static final Type UINT32
The native unsigned 32 bit integer type
-
SINT32
public static final Type SINT32
The native signed 32 bit integer type
-
UINT64
public static final Type UINT64
The native unsigned 64 bit integer type
-
SINT64
public static final Type SINT64
The native signed 64 bit integer type
-
POINTER
public static final Type POINTER
The native memory address type
-
UCHAR
public static final Type UCHAR
The native unsigned char type
-
SCHAR
public static final Type SCHAR
The native signed char type
-
USHORT
public static final Type USHORT
The native unsigned short integer type
-
SSHORT
public static final Type SSHORT
The native signed short integer type
-
UINT
public static final Type UINT
The native unsigned integer type
-
SINT
public static final Type SINT
The native signed integer type
-
ULONG
public static final Type ULONG
The native unsigned long integer type
-
SLONG
public static final Type SLONG
The native signed long integer type
-
ULONG_LONG
public static final Type ULONG_LONG
The native unsigned long long integer type
-
SLONG_LONG
public static final Type SLONG_LONG
The native signed long long integer type
-
type
private int type
-
size
private int size
-
alignment
private int alignment
-
handle
private volatile long handle
-
-
Method Detail
-
type
public final int type()
Gets the FFI type enum value for thisType
- Returns:
- An integer representing the FFI type.
-
handle
final long handle()
Gets the native address of the ffi_type struct for thisType
- Returns:
- The address of the ffi_type structure
-
size
public final int size()
Gets the size of this type.- Returns:
- The size of this type, in bytes.
-
alignment
public final int alignment()
Gets the alignment of this type.- Returns:
- The alignment of this type, in bytes.
-
resolveType
private int resolveType()
-
resolveSize
private int resolveSize()
-
resolveAlignment
private int resolveAlignment()
-
resolveHandle
private long resolveHandle()
-
getTypeInfo
abstract Type.TypeInfo getTypeInfo()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
nativeHandles
static long[] nativeHandles(Type[] types)
Converts an array ofType
objects into an array of pointers to ffi_type structures.- Parameters:
types
- An array ofType
objects- Returns:
- An array of native ffi_type handles.
-
nativeHandles
static long[] nativeHandles(java.util.List<Type> types)
Converts a list ofType
objects into an array of pointers to ffi_type structures.- Parameters:
types
- A list ofType
objects- Returns:
- An array of native ffi_type handles.
-
builtin
private static Type builtin(NativeType nativeType)
Creates aType
instance for builtin types.- Parameters:
nativeType
- The builtin type enum.- Returns:
- A
Type
instance.
-
-