uk.ac.starlink.hapi

## Class CsvReader

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

-     public class CsvReader
      extends java.lang.Object

  CSV file reader. This is intended for use with HAPI CSV responses, and hence is supposed to conform to RFC 4180-flavoured CSV files containing UTF-8 characters.
  Since:
    11 Jan 2024
  See Also:
    RFC 4180

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CsvReader()` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String[]` | `readCsvRow(java.io.InputStream in)` Returns the next row from a given input stream.
    `void` | `setPrefixByte(byte byte0)` Provides a single byte to be read before the start of the input stream on the next invocation of `readCsvRow(java.io.InputStream)`.

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

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

- - ### Constructor Detail

    - #### CsvReader

          public CsvReader()

      Constructor.

  - ### Method Detail

    - #### setPrefixByte

          public void setPrefixByte(byte byte0)

      Provides a single byte to be read before the start of the input stream on the next invocation of `readCsvRow(java.io.InputStream)`. Once read, it will not be read again.
      Parameters:
        `byte0` - prefix byte

    - #### readCsvRow

          public java.lang.String[] readCsvRow(java.io.InputStream in)
                                        throws java.io.IOException

      Returns the next row from a given input stream. A prefix byte, if it has been supplied, will be read first. If the end of the stream is encountered, null is returned, but the file is not closed.
      Parameters:
        `in` - input stream
      Returns:
        array of fields in the next row, or null if the end of the stream is reached
      Throws:
        `java.io.IOException`