Class H5Type

java.lang.Object
nz.org.riskscape.hdf5.H5Object
nz.org.riskscape.hdf5.types.H5Type
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
H5ArrayType, H5CompoundType, H5EnumType, H5FloatType, H5IntegerType, H5StringType, H5VlenType

public abstract class H5Type extends H5Object

Represents an H5 data type, with some conveniences for mapping these to Riskscape types. Each type should produce native java objects that can be coerced easily by the riskscape type it maps to

  • Constructor Details

    • H5Type

      protected H5Type(long ptr)
  • Method Details

    • build

      public static H5Type build(long id)
    • toType

      public abstract nz.org.riskscape.engine.types.Type toType()
      Returns:
      a Riskscape type that mirrors the HD5 data type
    • read

      public abstract Object read(ByteBuffer outBuf, int offset)
      Returns:
      a java object that represents the data that was stored in the outBuf if it was of this data type. This java object should be coercable in to the type returned from toType()
    • getClassName

      public String getClassName()
      Returns:
      the H5 library's name for this type
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
    • isVariableLength

      public abstract boolean isVariableLength()
      Returns:
      true if this type is, or contains something, of variable length. As yet, this H5 support in this plugin can not read datasets of variable length type
    • readVlen

      public Object[] readVlen(byte[] rawBytes)

      Special case read method for reading variable length data from the result of a call to H5.h5d_readVL. Note that the type that should be doing the reading is the member type, not the vlen type itself.

      Parameters:
      rawBytes - the result of reading a vlen type from a dataset by H5Dataset.readVlenElements(H5DataSpace, H5DataSpace, int) via H5.H5DreadVL(long, long, long, long, long, Object[]). These bytes are the raw data representation of each selected element that was read.
      Returns:
      a variable length number of elements of this type
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in class H5Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDataSize

      public long getDataSize()

      The size in bytes of any element of this type.