Package com.bc.ceres.binio
Class TypeBuilder
java.lang.Object
com.bc.ceres.binio.TypeBuilder
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
FieldsModifier and TypeFieldDescriptionstatic final SimpleTypeThe 8-bit signed integer type.static final SimpleTypeThe 64-bit IEEE floating point type.static final SimpleTypeThe 32-bit IEEE floating point type.static final SimpleTypeThe 32-bit unsigned integer type.static final SimpleTypeThe 64-bit signed integer type.static final SimpleTypeThe 16-bit signed integer type.static final SimpleTypeThe 8-bit unsigned integer type.static final SimpleTypeThe 32-bit unsigned integer type.static final SimpleTypeThe 64-bit unsigned integer type.static final SimpleTypeThe 16-bit unsigned integer type. -
Method Summary
Modifier and TypeMethodDescriptionstatic CompoundTypeCOMPOUND(String name, CompoundMember... members) Creates a compound type.static CompoundMemberCreates a compound member.static SequenceTypeCreates a sequence type for the given element type and count.static VarSequenceTypeVAR_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 VarSequenceTypeVAR_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 Details
-
BYTE
The 8-bit signed integer type. -
UBYTE
The 8-bit unsigned integer type. -
SHORT
The 16-bit signed integer type. -
USHORT
The 16-bit unsigned integer type. -
INT
The 32-bit unsigned integer type. -
UINT
The 32-bit unsigned integer type. -
LONG
The 64-bit signed integer type. -
ULONG
The 64-bit unsigned integer type. -
FLOAT
The 32-bit IEEE floating point type. -
DOUBLE
The 64-bit IEEE floating point type.
-
-
Method Details
-
SEQUENCE
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
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
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
Creates a compound member.- Parameters:
name- The member's name.type- The member's type.- Returns:
- The compound member.
- See Also:
-
COMPOUND
Creates a compound type.- Parameters:
name- The compound's name.members- The compound's members.- Returns:
- The compound type.
-