Package com.bc.ceres.binio
Class TypeBuilder
- java.lang.Object
-
- com.bc.ceres.binio.TypeBuilder
-
public class TypeBuilder extends Object
A utility class which fosters the construction of complex type defintions. Its usage should be self-explaining, e.g.:import static binio.util.TypeBuilder.*; ... CompoundType scanlineType = COMPOUND("Scanline", MEMBER("flags", USHORT), MEMBER("samples", SEQUENCE(DOUBLE, 512)) ); }; CompoundType datasetType = COMPOUND("Dataset", MEMBER("lineCount", UINT), MEMBER("scanlines", VAR_SEQUENCE(scanlineType, "lineCount")) ); }; ...
-
-
Field Summary
Fields Modifier and Type Field Description static SimpleType
BYTE
The 8-bit signed integer type.static SimpleType
DOUBLE
The 64-bit IEEE floating point type.static SimpleType
FLOAT
The 32-bit IEEE floating point type.static SimpleType
INT
The 32-bit unsigned integer type.static SimpleType
LONG
The 64-bit signed integer type.static SimpleType
SHORT
The 16-bit signed integer type.static SimpleType
UBYTE
The 8-bit unsigned integer type.static SimpleType
UINT
The 32-bit unsigned integer type.static SimpleType
ULONG
The 64-bit unsigned integer type.static SimpleType
USHORT
The 16-bit unsigned integer type.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CompoundType
COMPOUND(String name, CompoundMember... members)
Creates a compound type.static CompoundMember
MEMBER(String name, Type type)
Creates a compound member.static SequenceType
SEQUENCE(Type elementType, int elementCount)
Creates a sequence type for the given element type and count.static VarSequenceType
VAR_SEQUENCE(Type elementType, int memberIndex)
Creates a dynamic sequence type whose element count is resolved by a compound member determined by the given member index.static VarSequenceType
VAR_SEQUENCE(Type elementType, String memberName)
Creates a dynamic sequence type whose element count is resolved by a compound member determined by the given member name.
-
-
-
Field Detail
-
BYTE
public static final SimpleType BYTE
The 8-bit signed integer type.
-
UBYTE
public static final SimpleType UBYTE
The 8-bit unsigned integer type.
-
SHORT
public static final SimpleType SHORT
The 16-bit signed integer type.
-
USHORT
public static final SimpleType USHORT
The 16-bit unsigned integer type.
-
INT
public static final SimpleType INT
The 32-bit unsigned integer type.
-
UINT
public static final SimpleType UINT
The 32-bit unsigned integer type.
-
LONG
public static final SimpleType LONG
The 64-bit signed integer type.
-
ULONG
public static final SimpleType ULONG
The 64-bit unsigned integer type.
-
FLOAT
public static final SimpleType FLOAT
The 32-bit IEEE floating point type.
-
DOUBLE
public static final SimpleType DOUBLE
The 64-bit IEEE floating point type.
-
-
Method Detail
-
SEQUENCE
public static SequenceType SEQUENCE(Type elementType, int elementCount)
Creates a sequence type for the given element type and count. If element count is greater or equal to zero, a fixed-length sequence type will be created. If element count is less than zero, a growable sequence type will be created.- Parameters:
elementType
- The sequence's element type.elementCount
- The sequence's element count.- Returns:
- A sequence type.
-
VAR_SEQUENCE
public static VarSequenceType VAR_SEQUENCE(Type elementType, String memberName)
Creates a dynamic sequence type whose element count is resolved by a compound member determined by the given member name. The member must have integer type.- Parameters:
elementType
- The sequence's element type.memberName
- The parent compount's member name.- Returns:
- A dynamic sequence type.
-
VAR_SEQUENCE
public static VarSequenceType VAR_SEQUENCE(Type elementType, int memberIndex)
Creates a dynamic sequence type whose element count is resolved by a compound member determined by the given member index. The member must have integer type.- Parameters:
elementType
- The sequence's element type.memberIndex
- The parent compount's member index.- Returns:
- A dynamic sequence type.
-
MEMBER
public static CompoundMember MEMBER(String name, Type type)
Creates a compound member.- Parameters:
name
- The member's name.type
- The member's type.- Returns:
- The compound member.
- See Also:
COMPOUND(String, CompoundMember[])
-
COMPOUND
public static CompoundType COMPOUND(String name, CompoundMember... members)
Creates a compound type.- Parameters:
name
- The compound's name.members
- The compound's members.- Returns:
- The compound type.
-
-