uk.ac.starlink.hapi

## Class ParamReader

- java.lang.Object
- - uk.ac.starlink.hapi.ParamReader

-     public class ParamReader
      extends java.lang.Object

  Reads values specified by a particular parameter from a HAPI data stream. Instances of this class are safe for concurrent use from multiple threads.
  Since:
    12 Jan 2024

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ParamReader` | `createReader(HapiParam param)` Returns a ParamReader instance for a given HAPI parameter.
    `int` | `getByteCount()` Returns the number of bytes in a HAPI binary stream read by this reader.
    `int` | `getColumnCount()` Returns the number of StarTable columns read by this reader.
    `ColumnInfo` | `getColumnInfo(int icol)` Returns the column metadata for one of the StarTable columns read by this reader.
    `int` | `getFieldCount()` Returns the number of HAPI table fields read by this reader.
    `void` | `readBinaryValues(byte[] buf, int istart, java.lang.Object[] result)` Converts from HAPI binary stream bytes to StarTable cell values.
    `void` | `readStringValues(java.lang.String[] cells, int istart, java.lang.Object[] result)` Converts from HAPI CSV text cell values to StarTable cell values.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getColumnCount

          public int getColumnCount()

      Returns the number of StarTable columns read by this reader.
      Returns:
        STIL column count

    - #### getColumnInfo

          public ColumnInfo getColumnInfo(int icol)

      Returns the column metadata for one of the StarTable columns read by this reader.
      Parameters:
        `icol` - column index, in range 0..getColumnCount()
      Returns:
        column metadata

    - #### getFieldCount

          public int getFieldCount()

      Returns the number of HAPI table fields read by this reader.
      Returns:
        field count

    - #### getByteCount

          public int getByteCount()

      Returns the number of bytes in a HAPI binary stream read by this reader.
      Returns:
        binary stream byte read count

    - #### readStringValues

          public void readStringValues(java.lang.String[] cells,
                                       int istart,
                                       java.lang.Object[] result)

      Converts from HAPI CSV text cell values to StarTable cell values.
      Parameters:
        `cells` - array of CSV field values
        `istart` - index of first CSV field of interest in cells
        `result` - columnCount-element array into which output values will be written

    - #### readBinaryValues

          public void readBinaryValues(byte[] buf,
                                       int istart,
                                       java.lang.Object[] result)

      Converts from HAPI binary stream bytes to StarTable cell values.
      Parameters:
        `buf` - buffer containing HAPI binary stream data
        `istart` - index of first byte of interest in buffer
        `result` - columnCount-element array into which output values will be written

    - #### createReader

          public static ParamReader createReader(HapiParam param)

      Returns a ParamReader instance for a given HAPI parameter.
      Parameters:
        `param` - HAPI parameter