uk.ac.starlink.hapi

## Class HapiSource

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

-     public class HapiSource
      extends java.lang.Object

  Knows how to load a HAPI table.
  Since:
    23 Jan 2024

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HapiSource(HapiService service, java.net.URL dataUrl, HapiParam[] params)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.String` | `getLabel()` Returns a human-readable label for the table that will be loaded.
    `java.net.URL` | `getStandaloneUrl()` Returns a standalone URL from which it ought to be possible to load this object's table.
    `int` | `hashCode()`
    `void` | `streamHapi(TableSink sink, int chunkLimit, IOConsumer<java.lang.String> limitCallback)` Streams this object's table to a supplied TableSink.

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

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

- - ### Constructor Detail

    - #### HapiSource

          public HapiSource(HapiService service,
                            java.net.URL dataUrl,
                            HapiParam[] params)

      Constructor.

      The `params` parameter is optional, but if present must match the data from the dataUrl. If it is absent a query requesting the header data is submitted.

      Parameters:
        `service` - service
        `dataUrl` - URL of HAPI file without header
        `params` - parameters being read from dataUrl contents, may be null

  - ### Method Detail

    - #### getStandaloneUrl

          public java.net.URL getStandaloneUrl()

      Returns a standalone URL from which it ought to be possible to load this object's table.

      Feeding the contents of the returned URL to `HapiTableBuilder.streamStarTable(java.io.InputStream, uk.ac.starlink.table.TableSink, java.lang.String)` should generate a table ready for use. The table read by `streamHapi(uk.ac.starlink.table.TableSink, int, uk.ac.starlink.util.IOConsumer<java.lang.String>)` may not actually be generated by this method but if the service obeys the HAPI standard it ought to give the same results.

      Returns:
        standalone HAPI format table load URL

    - #### getLabel

          public java.lang.String getLabel()

      Returns a human-readable label for the table that will be loaded.
      Returns:
        table label

    - #### streamHapi

          public void streamHapi(TableSink sink,
                                 int chunkLimit,
                                 IOConsumer<java.lang.String> limitCallback)
                          throws java.io.IOException

      Streams this object's table to a supplied TableSink.
      Parameters:
        `sink` - table destination
        `chunkLimit` - maximum number of chunks allowed
        `limitCallback` - called with a message if chunk limit is exceeded; may be null
      Throws:
        `java.io.IOException`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`