Interface IonLoader


public interface IonLoader
Loads Ion data in the form of datagrams. These methods parse the input in its entirety to identify problems immediately. In contrast, an IonReader will parse one top-level value at a time, and is better suited for streaming protocols or large inputs.

WARNING: This interface should not be implemented or extended by code outside of this library.

Implementations of this interface are safe for use by multiple threads.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the IonCatalog being used by this loader.
    Gets the IonSystem from which this loader was created.
    load(byte[] ionData)
    Loads a block of Ion data into a single datagram, detecting whether it's text or binary data.
    load(IonReader reader)
    Loads an entire stream of Ion data into a single datagram, detecting whether it's text or binary data.
    load(File ionFile)
    Loads an entire file of Ion data into a single datagram, detecting whether it's text or binary data.
    load(InputStream ionData)
    Deprecated.
    Will cause a memory leak when reading a gzipped stream.
    load(Reader ionText)
    Loads a stream of Ion text into a single datagram.
    load(String ionText)
    Loads Ion text in its entirety.
  • Method Details

    • getSystem

      IonSystem getSystem()
      Gets the IonSystem from which this loader was created.
      Returns:
      the system instance; not null.
    • getCatalog

      IonCatalog getCatalog()
      Gets the IonCatalog being used by this loader.
      Returns:
      a catalog; not null.
    • load

      IonDatagram load(File ionFile) throws IonException, IOException
      Loads an entire file of Ion data into a single datagram, detecting whether it's text or binary data.
      Parameters:
      ionFile - a file containing Ion data.
      Returns:
      a datagram containing all the values in the file; not null.
      Throws:
      IonException - if there's a syntax error in the Ion content.
      IOException - if reading from the specified file results in an IOException.
    • load

      IonDatagram load(String ionText) throws IonException
      Loads Ion text in its entirety.
      Parameters:
      ionText - must not be null.
      Returns:
      a datagram containing the input values; not null.
      Throws:
      NullPointerException - if ionText is null.
      IonException - if there's a syntax error in the Ion content.
    • load

      IonDatagram load(Reader ionText) throws IonException, IOException
      Loads a stream of Ion text into a single datagram.

      The specified reader remains open after this method returns.

      Because this library performs its own buffering, it's recommended that you avoid adding additional buffering to the given stream.

      Parameters:
      ionText - the reader from which to read Ion text.
      Returns:
      a datagram containing all the elements on the input stream; not null.
      Throws:
      NullPointerException - if ionText is null.
      IonException - if there's a syntax error in the Ion content.
      IOException - if reading from the specified input stream results in an IOException.
    • load

      IonDatagram load(byte[] ionData) throws IonException
      Loads a block of Ion data into a single datagram, detecting whether it's text or binary data.

      This method will auto-detect and uncompress GZIPped Ion data.

      Parameters:
      ionData - may be either Ion binary data, or UTF-8 Ion text. This method assumes ownership of the array and may modify it at will.
      Returns:
      a datagram containing all the values on the input stream; not null.
      Throws:
      NullPointerException - if ionData is null.
      IonException - if there's a syntax error in the Ion content.
    • load

      Deprecated.
      Will cause a memory leak when reading a gzipped stream. Use load(IonReader) instead.

      WARNING: Will cause a memory leak when reading a gzipped stream, use load(IonReader) instead.

      Loads an entire stream of Ion data into a single datagram, detecting whether it's text or binary data.

      The specified stream remains open after this method returns.

      This method will auto-detect and uncompress GZIPped Ion data.

      Because this library performs its own buffering, it's recommended that you avoid adding additional buffering to the given stream.

      Parameters:
      ionData - the stream from which to read Ion data.
      Returns:
      a datagram containing all the values on the input stream; not null.
      Throws:
      NullPointerException - if ionData is null.
      IonException - if there's a syntax error in the Ion content.
      IOException - if reading from the specified input stream results in an IOException.
    • load

      IonDatagram load(IonReader reader) throws IonException
      Loads an entire stream of Ion data into a single datagram, detecting whether it's text or binary data.

      The specified reader remains open after this method returns.

      Parameters:
      reader - @param reader source of the Ion data to load.
      Returns:
      a datagram containing all the values on the reader; not null.
      Throws:
      NullPointerException - if reader is null.
      IonException - if there's a syntax error in the Ion content.