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:
    IonReader
    • Method Detail

      • 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​(java.io.File ionFile)
                  throws IonException,
                         java.io.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.
        java.io.IOException - if reading from the specified file results in an IOException.
      • load

        IonDatagram load​(java.lang.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:
        java.lang.NullPointerException - if ionText is null.
        IonException - if there's a syntax error in the Ion content.
      • load

        IonDatagram load​(java.io.Reader ionText)
                  throws IonException,
                         java.io.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:
        java.lang.NullPointerException - if ionText is null.
        IonException - if there's a syntax error in the Ion content.
        java.io.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:
        java.lang.NullPointerException - if ionData is null.
        IonException - if there's a syntax error in the Ion content.
      • load

        @Deprecated
        IonDatagram load​(java.io.InputStream ionData)
                  throws IonException,
                         java.io.IOException
        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:
        java.lang.NullPointerException - if ionData is null.
        IonException - if there's a syntax error in the Ion content.
        java.io.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 -
        reader - source of the Ion data to load.
        Returns:
        a datagram containing all the values on the reader; not null.
        Throws:
        java.lang.NullPointerException - if reader is null.
        IonException - if there's a syntax error in the Ion content.