Module org.hdfgroup.object
Package hdf.object

# Class Datatype

Object
hdf.object.HObject
hdf.object.Datatype

All Implemented Interfaces:
  `MetaDataContainer`, `Serializable`

Direct Known Subclasses:
  `FitsDatatype`, `H4Datatype`, `H5Datatype`, `NC2Datatype`

public abstract class Datatype extends HObject implements MetaDataContainer
Datatype is an abstract class that defines datatype characteristics and APIs for a data type. A datatype has four basic characteristics: class, size, byte order and sign. These characteristics are defined in the See HDF5 Datatypes in HDF5 User Guide These characteristics apply to all the sub-classes. The sub-classes may have different ways to describe a datatype. We here define the native datatype to the datatype used by the sub-class. For example, H5Datatype uses a datatype identifier (hid_t) to specify a datatype. NC2Datatype uses ucar.nc2.DataType object to describe its datatype. "Native" here is different from the "native" definition in the HDF5 library. Two functions, createNative() and fromNative(), are defined to convert the general characteristics to/from the native datatype. Sub-classes must implement these functions so that the conversion will be done correctly. The values of the CLASS member are not identical to HDF5 values for a datatype class.

Version:
  1.1 9/4/2007
Author:
  Peter X. Cao
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long[]`
  `arrayDims`
  The dimensions of the ARRAY element of an ARRAY datatype.
  `protected Datatype`
  `baseType`
  The base datatype of this datatype (null if this datatype is atomic).
  `static final int`
  `CLASS_ARRAY`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_BITFIELD`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_CHAR`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_COMPOUND`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_ENUM`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_FLOAT`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_INTEGER`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_NO_CLASS`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_OPAQUE`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_REFERENCE`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_STRING`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_TIME`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `CLASS_VLEN`
  See HDF5 Datatypes in HDF5 User Guide
  `protected List<String>`
  `compoundMemberNames`
  The list of names of members of a compound Datatype.
  `protected List<Long>`
  `compoundMemberOffsets`
  The list of offsets of members of a compound Datatype.
  `protected List<Datatype>`
  `compoundMemberTypes`
  The list of types of members of a compound Datatype.
  `protected int`
  `datatypeClass`
  The class of the datatype.
  `protected String`
  `datatypeDescription`
  The description of the datatype.
  `protected boolean`
  `datatypeNATIVE`
  The description of the datatype.
  `protected int`
  `datatypeOrder`
  The byte order of the datatype.
  `protected int`
  `datatypeSign`
  The sign of the datatype.
  `protected long`
  `datatypeSize`
  The size (in bytes) of the datatype.
  `protected Map<String,String>`
  `enumMembers`
  The (name, value) pairs of enum members.
  `protected boolean`
  `isNamed`
  Determines whether this datatype is a named datatype
  `protected boolean`
  `isVariableStr`
  Determines whether this datatype is a variable-length string type.
  `protected boolean`
  `isVLEN`
  Determines whether this datatype is a variable-length type.
  `static final int`
  `NATIVE`
  The default definition for datatype size, order, and sign.
  `static final int`
  `NSGN`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `ORDER_BE`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `ORDER_LE`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `ORDER_NONE`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `ORDER_VAX`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `SIGN_2`
  See HDF5 Datatypes in HDF5 User Guide
  `static final int`
  `SIGN_NONE`
  See HDF5 Datatypes in HDF5 User Guide

  ### Fields inherited from class hdf.object.HObject

  `fileFormat, linkTargetObjName, oid, SEPARATOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Datatype(int tclass, int tsize, int torder, int tsign)`
  Constructs a Datatype with specified class, size, byte order and sign.
  `Datatype(int tclass, int tsize, int torder, int tsign, Datatype tbase)`
  Constructs a Datatype with specified class, size, byte order and sign.
  `Datatype(int tclass, int tsize, int torder, int tsign, Datatype tbase, Datatype pbase)`
  Constructs a Datatype with specified class, size, byte order and sign.
  `Datatype(FileFormat theFile, int tclass, int tsize, int torder, int tsign, Datatype tbase, Datatype pbase)`
  Constructs a Datatype with specified class, size, byte order and sign.
  `Datatype(FileFormat theFile, long tid)`
  Constructs a Datatype with a given native datatype identifier.
  `Datatype(FileFormat theFile, long tid, Datatype pbase)`
  Constructs a Datatype with a given native datatype identifier.
  `Datatype(FileFormat theFile, String typeName, String typePath)`
  Constructs a named datatype with a given file, name and path.
  `Datatype(FileFormat theFile, String typeName, String typePath, long[] oid)`
  Deprecated.
  Not for public use in the future.
  Using `Datatype(FileFormat, String, String)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Removes all of the elements from metadata list.
  `abstract void`
  `close(long id)`
  Closes a datatype identifier.
  `abstract long`
  `createNative()`
  Converts the datatype object to a native datatype.
  `abstract void`
  `fromNative(long nativeID)`
  Set datatype characteristics (class, size, byte order and sign) from a given datatype identifier.
  `final long[]`
  `getArrayDims()`
  Returns the dimensions of an Array Datatype.
  `final List<String>`
  `getCompoundMemberNames()`
  Returns the member names of a Compound Datatype.
  `final List<Long>`
  `getCompoundMemberOffsets()`
  Returns the member offsets of a Compound Datatype.
  `final List<Datatype>`
  `getCompoundMemberTypes()`
  Returns member types of a Compound Datatype.
  `Datatype`
  `getDatatypeBase()`
  Returns the base datatype for this datatype.
  `int`
  `getDatatypeClass()`
  Returns the class of the datatype.
  `int`
  `getDatatypeOrder()`
  Returns the byte order of the datatype.
  `int`
  `getDatatypeSign()`
  Returns the sign (SIGN_NONE, SIGN_2) of an integer datatype.
  `long`
  `getDatatypeSize()`
  Returns the size of the datatype in bytes.
  `String`
  `getDescription()`
  Returns a short text description of this datatype.
  `final Map<String,String>`
  `getEnumMembers()`
  Returns the Map<String,String> pairs of enum members for enum datatype.
  `final String`
  `getEnumMembersAsString()`
  Returns the HashMap pairs of enum members for enum datatype.
  `List`
  `getMetadata()`
  Retrieves the object's metadata, such as attributes, from the file.
  `long`
  `getReferenceType()`
  If the datatype is a reference, then return the type.
  `boolean`
  `isArray()`
  Checks if this datatype is an array type.
  `boolean`
  `isBitField()`
  Checks if this datatype is a bitfield type.
  `boolean`
  `isChar()`
  Checks if this datatype is a character type.
  `boolean`
  `isCompound()`
  Checks if this datatype is an compound type.
  `boolean`
  `isEnum()`
  Checks if this datatype is a enum type.
  `boolean`
  `isFloat()`
  Checks if this datatype is a floating-point type.
  `boolean`
  `isInteger()`
  Checks if this datatype is an integer type.
  `boolean`
  `isNamed()`
  Checks if this datatype is a named type.
  `boolean`
  `isOpaque()`
  Checks if this datatype is a opaque type.
  `boolean`
  `isRef()`
  Checks if this datatype is a reference type.
  `boolean`
  `isString()`
  Checks if this datatype is a string type.
  `abstract boolean`
  `isText()`
  Checks if this datatype is a boolean type.
  `boolean`
  `isUnsigned()`
  Checks if this datatype is unsigned.
  `boolean`
  `isVarStr()`
  Checks if this datatype is a variable-length string type.
  `boolean`
  `isVLEN()`
  Checks if this datatype is a variable-length type.
  `long`
  `open()`
  Opens access to this named datatype.
  `void`
  `removeMetadata(Object info)`
  Deletes an existing piece of metadata from this object.
  `final void`
  `setEnumMembers(String enumStr)`
  Sets the (key, value) pairs of enum members for enum datatype.
  `String`
  `toString()`
  Returns the name of the object.
  `void`
  `updateMetadata(Object info)`
  Updates an existing piece of metadata attached to this object.
  `void`
  `writeMetadata(Object info)`
  Writes a specific piece of metadata (such as an attribute) into the file.

  ### Methods inherited from class hdf.object.HObject

  `createFullname, debug, equals, equals, equalsOID, getFID, getFile, getFileFormat, getFullName, getLinkTargetObjName, getName, getOID, getPath, hashCode, setFullname, setLinkTargetObjName, setName, setPath`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface hdf.object.MetaDataContainer

  `hasAttribute`

- ## Field Details

  - ### NATIVE

    public static final int NATIVE
    The default definition for datatype size, order, and sign.
    See Also:
      - Constant Field Values

  - ### CLASS_NO_CLASS

    public static final int CLASS_NO_CLASS
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_INTEGER

    public static final int CLASS_INTEGER
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_FLOAT

    public static final int CLASS_FLOAT
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_CHAR

    public static final int CLASS_CHAR
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_STRING

    public static final int CLASS_STRING
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_BITFIELD

    public static final int CLASS_BITFIELD
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_OPAQUE

    public static final int CLASS_OPAQUE
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_COMPOUND

    public static final int CLASS_COMPOUND
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_REFERENCE

    public static final int CLASS_REFERENCE
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_ENUM

    public static final int CLASS_ENUM
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_VLEN

    public static final int CLASS_VLEN
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_ARRAY

    public static final int CLASS_ARRAY
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### CLASS_TIME

    public static final int CLASS_TIME
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### ORDER_LE

    public static final int ORDER_LE
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### ORDER_BE

    public static final int ORDER_BE
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### ORDER_VAX

    public static final int ORDER_VAX
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### ORDER_NONE

    public static final int ORDER_NONE
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### SIGN_NONE

    public static final int SIGN_NONE
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### SIGN_2

    public static final int SIGN_2
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### NSGN

    public static final int NSGN
    See HDF5 Datatypes in HDF5 User Guide
    See Also:
      - Constant Field Values

  - ### datatypeDescription

    protected String datatypeDescription
    The description of the datatype.

  - ### datatypeNATIVE

    protected boolean datatypeNATIVE
    The description of the datatype.

  - ### datatypeClass

    protected int datatypeClass
    The class of the datatype.

  - ### datatypeSize

    protected long datatypeSize
    The size (in bytes) of the datatype.

  - ### datatypeOrder

    protected int datatypeOrder
    The byte order of the datatype. Valid values are ORDER_LE, ORDER_BE, and ORDER_VAX.

  - ### datatypeSign

    protected int datatypeSign
    The sign of the datatype.

  - ### baseType

    protected Datatype baseType
    The base datatype of this datatype (null if this datatype is atomic).

  - ### isNamed

    protected boolean isNamed
    Determines whether this datatype is a named datatype

  - ### arrayDims

    protected long[] arrayDims
    The dimensions of the ARRAY element of an ARRAY datatype.

  - ### isVLEN

    protected boolean isVLEN
    Determines whether this datatype is a variable-length type.

  - ### isVariableStr

    protected boolean isVariableStr
    Determines whether this datatype is a variable-length string type.

  - ### enumMembers

    protected Map<String,String> enumMembers
    The (name, value) pairs of enum members.

  - ### compoundMemberNames

    protected List<String> compoundMemberNames
    The list of names of members of a compound Datatype.

  - ### compoundMemberTypes

    protected List<Datatype> compoundMemberTypes
    The list of types of members of a compound Datatype.

  - ### compoundMemberOffsets

    protected List<Long> compoundMemberOffsets
    The list of offsets of members of a compound Datatype.

- ## Constructor Details

  - ### Datatype

    public Datatype(FileFormat theFile, String typeName, String typePath)
    Constructs a named datatype with a given file, name and path.
    Parameters:
      `theFile` - the HDF file.
      `typeName` - the name of the datatype, e.g "12-bit Integer".
      `typePath` - the full group path of the datatype, e.g. "/datatypes/".

  - ### Datatype

    @Deprecated public Datatype(FileFormat theFile, String typeName, String typePath, long[] oid)
    Deprecated.
    Not for public use in the future.
    Using `Datatype(FileFormat, String, String)`
    Parameters:
      `theFile` - the HDF file.
      `typeName` - the name of the datatype, e.g "12-bit Integer".
      `typePath` - the full group path of the datatype, e.g. "/datatypes/".
      `oid` - the oidof the datatype.

  - ### Datatype

    public Datatype(int tclass, int tsize, int torder, int tsign) throws Exception
    Constructs a Datatype with specified class, size, byte order and sign. The following is a list of a few examples of Datatype.
    1. to create unsigned native integer
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, Datatype.NATIVE, Datatype.NATIVE, Datatype.SIGN_NONE);
    2. to create 16-bit signed integer with big endian
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, 2, Datatype.ORDER_BE, Datatype.NATIVE);
    3. to create native float
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, Datatype.NATIVE, Datatype.NATIVE, Datatype.NATIVE);
    4. to create 64-bit double
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE);
    Parameters:
      `tclass` - the class of the datatype, e.g. CLASS_INTEGER, CLASS_FLOAT and etc.
      `tsize` - the size of the datatype in bytes, e.g. for a 32-bit integer, the size is 4. Valid values are NATIVE or a positive value.
      `torder` - the byte order of the datatype. Valid values are ORDER_LE, ORDER_BE, ORDER_VAX, ORDER_NONE and NATIVE.
      `tsign` - the sign of the datatype. Valid values are SIGN_NONE, SIGN_2 and NATIVE.
    Throws:
      `Exception` - if there is an error

  - ### Datatype

    public Datatype(int tclass, int tsize, int torder, int tsign, Datatype tbase) throws Exception
    Constructs a Datatype with specified class, size, byte order and sign. The following is a list of a few examples of Datatype.
    1. to create unsigned native integer
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, Datatype.NATIVE, Datatype.NATIVE, Datatype.SIGN_NONE);
    2. to create 16-bit signed integer with big endian
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, 2, Datatype.ORDER_BE, Datatype.NATIVE);
    3. to create native float
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, Datatype.NATIVE, Datatype.NATIVE, Datatype.NATIVE);
    4. to create 64-bit double
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE);
    Parameters:
      `tclass` - the class of the datatype, e.g. CLASS_INTEGER, CLASS_FLOAT and etc.
      `tsize` - the size of the datatype in bytes, e.g. for a 32-bit integer, the size is 4. Valid values are NATIVE or a positive value.
      `torder` - the byte order of the datatype. Valid values are ORDER_LE, ORDER_BE, ORDER_VAX, ORDER_NONE and NATIVE.
      `tsign` - the sign of the datatype. Valid values are SIGN_NONE, SIGN_2 and NATIVE.
      `tbase` - the base datatype of the new datatype
    Throws:
      `Exception` - if there is an error

  - ### Datatype

    public Datatype(FileFormat theFile, int tclass, int tsize, int torder, int tsign, Datatype tbase, Datatype pbase) throws Exception
    Constructs a Datatype with specified class, size, byte order and sign. The following is a list of a few examples of Datatype.
    1. to create unsigned native integer
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, Datatype.NATIVE, Datatype.NATIVE, Datatype.SIGN_NONE);
    2. to create 16-bit signed integer with big endian
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, 2, Datatype.ORDER_BE, Datatype.NATIVE);
    3. to create native float
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, Datatype.NATIVE, Datatype.NATIVE, Datatype.NATIVE);
    4. to create 64-bit double
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE);
    Parameters:
      `theFile` - the HDF file.
      `tclass` - the class of the datatype, e.g. CLASS_INTEGER, CLASS_FLOAT and etc.
      `tsize` - the size of the datatype in bytes, e.g. for a 32-bit integer, the size is 4. Valid values are NATIVE or a positive value.
      `torder` - the byte order of the datatype. Valid values are ORDER_LE, ORDER_BE, ORDER_VAX, ORDER_NONE and NATIVE.
      `tsign` - the sign of the datatype. Valid values are SIGN_NONE, SIGN_2 and NATIVE.
      `tbase` - the base datatype of the new datatype
      `pbase` - the parent datatype of the new datatype
    Throws:
      `Exception` - if there is an error

  - ### Datatype

    public Datatype(int tclass, int tsize, int torder, int tsign, Datatype tbase, Datatype pbase) throws Exception
    Constructs a Datatype with specified class, size, byte order and sign. The following is a list of a few examples of Datatype.
    1. to create unsigned native integer
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, Datatype.NATIVE, Datatype.NATIVE, Datatype.SIGN_NONE);
    2. to create 16-bit signed integer with big endian
       Datatype type = new Dataype(Datatype.CLASS_INTEGER, 2, Datatype.ORDER_BE, Datatype.NATIVE);
    3. to create native float
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, Datatype.NATIVE, Datatype.NATIVE, Datatype.NATIVE);
    4. to create 64-bit double
       Datatype type = new Dataype(Datatype.CLASS_FLOAT, 8, Datatype.NATIVE, Datatype.NATIVE);
    Parameters:
      `tclass` - the class of the datatype, e.g. CLASS_INTEGER, CLASS_FLOAT and etc.
      `tsize` - the size of the datatype in bytes, e.g. for a 32-bit integer, the size is 4. Valid values are NATIVE or a positive value.
      `torder` - the byte order of the datatype. Valid values are ORDER_LE, ORDER_BE, ORDER_VAX, ORDER_NONE and NATIVE.
      `tsign` - the sign of the datatype. Valid values are SIGN_NONE, SIGN_2 and NATIVE.
      `tbase` - the base datatype of the new datatype
      `pbase` - the parent datatype of the new datatype
    Throws:
      `Exception` - if there is an error

  - ### Datatype

    public Datatype(FileFormat theFile, long tid) throws Exception
    Constructs a Datatype with a given native datatype identifier. For example, if the datatype identifier is a 32-bit unsigned integer created from HDF5,

         long tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_UNINT32);
         Datatype dtype = new Datatype(tid);

    will construct a datatype equivalent to new Datatype(CLASS_INTEGER, 4, NATIVE, SIGN_NONE);
    Parameters:
      `theFile` - the HDF file.
      `tid` - the native datatype identifier.
    Throws:
      `Exception` - if there is an error
    See Also:
      - `fromNative(long tid)`

  - ### Datatype

    public Datatype(FileFormat theFile, long tid, Datatype pbase) throws Exception
    Constructs a Datatype with a given native datatype identifier. For example, if the datatype identifier is a 32-bit unsigned integer created from HDF5,

         long tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_UNINT32);
         Datatype dtype = new Datatype(tid);

    will construct a datatype equivalent to new Datatype(CLASS_INTEGER, 4, NATIVE, SIGN_NONE);
    Parameters:
      `theFile` - the HDF file.
      `tid` - the native datatype identifier.
      `pbase` - the parent datatype of the new datatype
    Throws:
      `Exception` - if there is an error
    See Also:
      - `fromNative(long tid)`

- ## Method Details

  - ### open

    public long open()
    Opens access to this named datatype. Sub-classes must replace this default implementation. For example, in H5Datatype, open() function H5.H5Topen(loc_id, name) to get the datatype identifier.
    Specified by:
      `open` in class `HObject`
    Returns:
      the datatype identifier if successful; otherwise returns negative value.
    See Also:
      - `HObject.close(long)`

  - ### close

    public abstract void close(long id)
    Closes a datatype identifier. Sub-classes must replace this default implementation.
    Specified by:
      `close` in class `HObject`
    Parameters:
      `id` - the datatype identifier to close.

  - ### getDatatypeClass

    public int getDatatypeClass()
    Returns the class of the datatype. Valid values are:
    - CLASS_NO_CLASS
    - CLASS_INTEGER
    - CLASS_FLOAT
    - CLASS_CHAR
    - CLASS_STRING
    - CLASS_BITFIELD
    - CLASS_OPAQUE
    - CLASS_COMPOUND
    - CLASS_REFERENCE
    - CLASS_ENUM
    - CLASS_VLEN
    - CLASS_ARRAY
    Returns:
      the class of the datatype.

  - ### getDatatypeSize

    public long getDatatypeSize()
    Returns the size of the datatype in bytes. For example, for a 32-bit integer, the size is 4 (bytes).
    Returns:
      the size of the datatype.

  - ### getDatatypeOrder

    public int getDatatypeOrder()
    Returns the byte order of the datatype. Valid values are
    - ORDER_LE
    - ORDER_BE
    - ORDER_VAX
    - ORDER_NONE
    Returns:
      the byte order of the datatype.

  - ### getDatatypeSign

    public int getDatatypeSign()
    Returns the sign (SIGN_NONE, SIGN_2) of an integer datatype.
    Returns:
      the sign of the datatype.

  - ### getDatatypeBase

    public Datatype getDatatypeBase()
    Returns the base datatype for this datatype. For example, in a dataset of type ARRAY of integer, the datatype of the dataset is ARRAY. The datatype of the base type is integer.
    Returns:
      the datatype of the contained basetype.

  - ### setEnumMembers

    public final void setEnumMembers(String enumStr)
    Sets the (key, value) pairs of enum members for enum datatype. For Example,
    setEnumMembers("-40=lowTemp, 90=highTemp")
      sets the key of enum member lowTemp to -40 and highTemp to 90.
    setEnumMembers("lowTemp, highTemp")
      sets enum members to defaults, i.e. 0=lowTemp and 1=highTemp
    setEnumMembers("10=lowTemp, highTemp")
      sets enum member lowTemp to 10 and highTemp to 11.
    Parameters:
      `enumStr` - the (key, value) pairs of enum members

  - ### getEnumMembers

    public final Map<String,String> getEnumMembers()
    Returns the Map<String,String> pairs of enum members for enum datatype.
    Returns:
      enumStr Map<String,String%gt; pairs of enum members

  - ### getEnumMembersAsString

    public final String getEnumMembersAsString()
    Returns the HashMap pairs of enum members for enum datatype. For Example,
    getEnumMembersAsString()
      returns "10=lowTemp, 40=highTemp"
    Returns:
      enumStr the (key, value) pairs of enum members

  - ### getArrayDims

    public final long[] getArrayDims()
    Returns the dimensions of an Array Datatype.
    Returns:
      dims the dimensions of the Array Datatype

  - ### getCompoundMemberNames

    public final List<String> getCompoundMemberNames()
    Returns the member names of a Compound Datatype.
    Returns:
      member names of a Compound Datatype

  - ### getCompoundMemberTypes

    public final List<Datatype> getCompoundMemberTypes()
    Returns member types of a Compound Datatype.
    Returns:
      member types of a Compound Datatype

  - ### getCompoundMemberOffsets

    public final List<Long> getCompoundMemberOffsets()
    Returns the member offsets of a Compound Datatype.
    Returns:
      member offsets of a Compound Datatype

  - ### createNative

    public abstract long createNative()
    Converts 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 to

         int tid = H5.H5Tcopy(HDF5Constants.H5T_NATIVE_UNINT32);

    Returns:
      the identifier of the native datatype.

  - ### fromNative

    public abstract void fromNative(long nativeID)
    Set datatype characteristics (class, size, byte order and sign) from a given datatype identifier. Sub-classes must implement it so that this datatype will be converted accordingly. For example, if the type identifier is a 64-bit unsigned integer created from HDF5,

         H5Datatype dtype = new H5Datatype();
         dtype.fromNative(HDF5Constants.H5T_NATIVE_UNINT32);

    Where dtype is equivalent to
    new H5Datatype(CLASS_INTEGER, 4, NATIVE, SIGN_NONE);
    Parameters:
      `nativeID` - the datatype identifier.

  - ### getReferenceType

    public long getReferenceType()
    If the datatype is a reference, then return the type.
    Returns:
      the datatype reference type if successful; otherwise returns negative value.

  - ### getDescription

    public String getDescription()
    Returns a short text description of this datatype.
    Returns:
      a short text description of this datatype

  - ### isUnsigned

    public boolean isUnsigned()
    Checks if this datatype is unsigned.
    Returns:
      true if the datatype is unsigned; otherwise, returns false.

  - ### isText

    public abstract boolean isText()
    Checks if this datatype is a boolean type.
    Returns:
      true if the datatype is boolean; false otherwise

  - ### isInteger

    public boolean isInteger()
    Checks if this datatype is an integer type.
    Returns:
      true if the datatype is integer; false otherwise

  - ### isFloat

    public boolean isFloat()
    Checks if this datatype is a floating-point type.
    Returns:
      true if the datatype is floating-point; false otherwise

  - ### isNamed

    public boolean isNamed()
    Checks if this datatype is a named type.
    Returns:
      true if the datatype is named; false otherwise

  - ### isVarStr

    public boolean isVarStr()
    Checks if this datatype is a variable-length string type.
    Returns:
      true if the datatype is variable-length string; false otherwise

  - ### isVLEN

    public boolean isVLEN()
    Checks if this datatype is a variable-length type.
    Returns:
      true if the datatype is variable-length; false otherwise

  - ### isCompound

    public boolean isCompound()
    Checks if this datatype is an compound type.
    Returns:
      true if the datatype is compound; false otherwise

  - ### isArray

    public boolean isArray()
    Checks if this datatype is an array type.
    Returns:
      true if the datatype is array; false otherwise

  - ### isString

    public boolean isString()
    Checks if this datatype is a string type.
    Returns:
      true if the datatype is string; false otherwise

  - ### isChar

    public boolean isChar()
    Checks if this datatype is a character type.
    Returns:
      true if the datatype is character; false otherwise

  - ### isRef

    public boolean isRef()
    Checks if this datatype is a reference type.
    Returns:
      true if the datatype is reference; false otherwise

  - ### isEnum

    public boolean isEnum()
    Checks if this datatype is a enum type.
    Returns:
      true if the datatype is enum; false otherwise

  - ### isOpaque

    public boolean isOpaque()
    Checks if this datatype is a opaque type.
    Returns:
      true if the datatype is opaque; false otherwise

  - ### isBitField

    public boolean isBitField()
    Checks if this datatype is a bitfield type.
    Returns:
      true if the datatype is bitfield; false otherwise

  - ### clear

    public void clear()
    Removes all of the elements from metadata list. The list should be empty after this call returns.
    Specified by:
      `clear` in interface `MetaDataContainer`

  - ### getMetadata

    public List getMetadata() throws Exception
    Retrieves the object's metadata, such as attributes, from the file. Metadata, such as attributes, is stored in a List.
    Specified by:
      `getMetadata` in interface `MetaDataContainer`
    Returns:
      the list of metadata objects.
    Throws:
      `Exception` - if the metadata can not be retrieved

  - ### writeMetadata

    public void writeMetadata(Object info) throws Exception
    Writes a specific piece of metadata (such as an attribute) into the file. If an HDF(4&5) attribute exists in the file, this method updates its value. If the attribute does not exist in the file, it creates the attribute in the file and attaches it to the object. It will fail to write a new attribute to the object where an attribute with the same name already exists. To update the value of an existing attribute in the file, one needs to get the instance of the attribute by getMetadata(), change its values, then use writeMetadata() to write the value.
    Specified by:
      `writeMetadata` in interface `MetaDataContainer`
    Parameters:
      `info` - the metadata to write.
    Throws:
      `Exception` - if the metadata can not be written

  - ### removeMetadata

    public void removeMetadata(Object info) throws Exception
    Deletes an existing piece of metadata from this object.
    Specified by:
      `removeMetadata` in interface `MetaDataContainer`
    Parameters:
      `info` - the metadata to delete.
    Throws:
      `Exception` - if the metadata can not be removed

  - ### updateMetadata

    public void updateMetadata(Object info) throws Exception
    Updates an existing piece of metadata attached to this object.
    Specified by:
      `updateMetadata` in interface `MetaDataContainer`
    Parameters:
      `info` - the metadata to update.
    Throws:
      `Exception` - if the metadata can not be updated

  - ### toString

    public String toString()
    Description copied from class: `HObject`
    Returns the name of the object. This method overwrites the toString() method in the Java Object class (the root class of all Java objects) so that it returns the name of the HObject instead of the name of the class. For example, toString() returns "Raster Image #2" instead of "hdf.object.h4.H4SDS".
    Overrides:
      `toString` in class `HObject`
    Returns:
      The name of the object.