Class H5DatasetCursor

java.lang.Object
nz.org.riskscape.hdf5.cursor.H5DatasetCursor
All Implemented Interfaces:
Iterator<Object>
Direct Known Subclasses:
H5FixedSizeCursor

public abstract class H5DatasetCursor extends Object implements Iterator<Object>

Iterates over elements of an H5Dataset. Intended to be used primarily as an Iterator but also allows for random access.

  • Field Details

  • Constructor Details

  • Method Details

    • size

      public long size()
    • sizeAsInt

      public int sizeAsInt()
      Returns:
      same as size(), but throws an exception if the dataspace size doesn't fit in an integer value
    • getCurrentIndex

      public abstract long getCurrentIndex()

      Gets the current position of the cursor within the dataset elements.

      Returns:
      the index of the element that will be returned by next()
    • setCurrentIndex

      public abstract void setCurrentIndex(long index)

      Resets the position of the cursor to the given element index.

      Parameters:
      index - the index of the element that should be returned by next()
    • skip

      public abstract void skip()

      Advances the cursor index one step. Similar to calling Iterator.next() but without unmarshalling any data

    • peek

      public abstract Object peek()

      Same as Iterator.next() but the cursor position is not changed.

      Returns:
      object read from the current cursor position
    • peek

      public abstract Object peek(H5CompoundMember member)

      Read the data for member only. This can be more efficient than reading the data with Iterator.next(). Peeking does not affect the cursor position.

      Note that it is up to the caller to ensure that member is in fact a member of this cursor's data type. If it it not then unexpected results are likely.

      Parameters:
      member - member to read
      Returns:
      the value of member at the current cursor position