Object
hdf.object.HObject
hdf.object.Datatype
hdf.object.fits.FitsDatatype
- All Implemented Interfaces:
MetaDataContainer,Serializable
Datatype encapsulates information of a datatype.
Information includes the class, size, endian of a datatype.
- Version:
- 1.1 9/4/2007
- Author:
- Peter X. Cao
- See Also:
-
Field Summary
Fields inherited from class hdf.object.Datatype
arrayDims, baseType, CLASS_ARRAY, CLASS_BITFIELD, CLASS_CHAR, CLASS_COMPOUND, CLASS_ENUM, CLASS_FLOAT, CLASS_INTEGER, CLASS_NO_CLASS, CLASS_OPAQUE, CLASS_REFERENCE, CLASS_STRING, CLASS_TIME, CLASS_VLEN, compoundMemberNames, compoundMemberOffsets, compoundMemberTypes, datatypeClass, datatypeDescription, datatypeNATIVE, datatypeOrder, datatypeSign, datatypeSize, enumMembers, isNamed, isVariableStr, isVLEN, NATIVE, NSGN, ORDER_BE, ORDER_LE, ORDER_NONE, ORDER_VAX, SIGN_2, SIGN_NONEFields inherited from class hdf.object.HObject
fileFormat, linkTargetObjName, oid, SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionFitsDatatype(int tclass, int tsize, int torder, int tsign) Create an Datatype with specified class, size, byte order and sign.FitsDatatype(long theType) Create a Datatype with a given fits native datatype. -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectallocateArray(long dtype, int size) Allocate an one-dimensional array of byte, short, int, long, float, double, or String to store data retrieved from an fits file based on the given fits datatype and dimension sizes.voidclose(long id) Closes a datatype identifier.longConverts the datatype object to a native datatype.voidTranslate fits datatype identifier into FitsDatatype.voidfromNative(long dtype) Translate fits datatype identifier into FitsDatatype.Returns a short text description of this datatype.getMetadata(int... attrPropList) Retrieves the object's metadata, such as attributes, from the file.booleanCheck if the object has any attributes attached.booleanisText()Checks if this datatype is a boolean type.booleanChecks if this datatype is unsigned.Methods inherited from class hdf.object.Datatype
clear, getArrayDims, getCompoundMemberNames, getCompoundMemberOffsets, getCompoundMemberTypes, getDatatypeBase, getDatatypeClass, getDatatypeOrder, getDatatypeSign, getDatatypeSize, getEnumMembers, getEnumMembersAsString, getMetadata, getReferenceType, isArray, isBitField, isChar, isCompound, isEnum, isFloat, isInteger, isNamed, isOpaque, isRef, isString, isVarStr, isVLEN, open, removeMetadata, setEnumMembers, toString, updateMetadata, writeMetadataMethods inherited from class hdf.object.HObject
createFullname, debug, equals, equals, equalsOID, getFID, getFile, getFileFormat, getFullName, getLinkTargetObjName, getName, getOID, getPath, hashCode, setFullname, setLinkTargetObjName, setName, setPath
-
Constructor Details
-
FitsDatatype
Create an Datatype with specified class, size, byte order and sign. The following list a few example of how to create a Datatype.- to create unsigned native integer
FitsDatatype type = new H5Dataype(Datatype.CLASS_INTEGER, Datatype.NATIVE, Datatype.NATIVE, Datatype.SIGN_NONE); - to create 16-bit signed integer with big endian
FitsDatatype type = new H5Dataype(Datatype.CLASS_INTEGER, 2, Datatype.ORDER_BE, Datatype.NATIVE); - to create native
float
FitsDatatype type = new H5Dataype(Datatype.CLASS_FLOAT, Datatype.NATIVE, Datatype.NATIVE, Datatype.NATIVE); - to create 64-bit double
FitsDatatype type = new H5Dataype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE);
- Parameters:
tclass- the class of the datatype.tsize- the size of the datatype in bytes.torder- the order of the datatype.tsign- the sign of the datatype.- Throws:
Exception- if there is an error
- to create unsigned native integer
-
FitsDatatype
Create a Datatype with a given fits native datatype.- Parameters:
theType- the fits native datatype.- Throws:
Exception- if there is an error
-
-
Method Details
-
allocateArray
Allocate an one-dimensional array of byte, short, int, long, float, double, or String to store data retrieved from an fits file based on the given fits datatype and dimension sizes.- Parameters:
dtype- the fits datatype.size- the total size of the array.- Returns:
- the array object if successful and null otherwise.
- Throws:
OutOfMemoryError
-
fromNative
Translate fits datatype identifier into FitsDatatype. -
fromNative
Translate fits datatype identifier into FitsDatatype.- Specified by:
fromNativein classDatatype- Parameters:
dtype- the fits native datatype.
-
getDescription
Description copied from class:DatatypeReturns a short text description of this datatype.- Overrides:
getDescriptionin classDatatype- Returns:
- a short text description of this datatype
-
isText
Description copied from class:DatatypeChecks if this datatype is a boolean type. -
isUnsigned
Description copied from class:DatatypeChecks if this datatype is unsigned.- Overrides:
isUnsignedin classDatatype- Returns:
- true if the datatype is unsigned; otherwise, returns false.
-
createNative
Description copied from class:DatatypeConverts the datatype object to a native datatype. Subclasses must implement it so that this datatype will be converted accordingly. Use close() to close the native identifier; otherwise, the datatype will be left open. For example, a HDF5 datatype created from
H5Dataype dtype = new H5Datatype(CLASS_INTEGER, 4, NATIVE, SIGN_NONE); int tid = dtype.createNative();
The "tid" will be the HDF5 datatype id of a 64-bit unsigned integer, which is equivalent toint tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_UNINT32);
- Specified by:
createNativein classDatatype- Returns:
- the identifier of the native datatype.
-
close
Description copied from class:DatatypeCloses a datatype identifier. Sub-classes must replace this default implementation. -
getMetadata
Retrieves the object's metadata, such as attributes, from the file. Metadata, such as attributes, is stored in a List.- Parameters:
attrPropList- the list of properties to get- Returns:
- the list of metadata objects.
- Throws:
Exception- if the metadata can not be retrieved
-
hasAttribute
Description copied from interface:MetaDataContainerCheck if the object has any attributes attached.- Returns:
- true if it has any attributes, false otherwise.
-