Interface IonLoader
-
public interface IonLoaderLoads Ion data in the form of datagrams. These methods parse the input in its entirety to identify problems immediately. In contrast, anIonReaderwill 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 Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description IonCataloggetCatalog()Gets theIonCatalogbeing used by this loader.IonSystemgetSystem()Gets theIonSystemfrom which this loader was created.IonDatagramload(byte[] ionData)Loads a block of Ion data into a single datagram, detecting whether it's text or binary data.IonDatagramload(IonReader reader)Loads an entire stream of Ion data into a single datagram, detecting whether it's text or binary data.IonDatagramload(java.io.File ionFile)Loads an entire file of Ion data into a single datagram, detecting whether it's text or binary data.IonDatagramload(java.io.InputStream ionData)Deprecated.Will cause a memory leak when reading a gzipped stream.IonDatagramload(java.io.Reader ionText)Loads a stream of Ion text into a single datagram.IonDatagramload(java.lang.String ionText)Loads Ion text in its entirety.
-
-
-
Method Detail
-
getSystem
IonSystem getSystem()
Gets theIonSystemfrom which this loader was created.- Returns:
- the system instance; not
null.
-
getCatalog
IonCatalog getCatalog()
Gets theIonCatalogbeing 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 anIOException.
-
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- ifionTextis 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- ifionTextis null.IonException- if there's a syntax error in the Ion content.java.io.IOException- if reading from the specified input stream results in anIOException.
-
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- ifionDatais 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. Useload(IonReader)instead.WARNING: Will cause a memory leak when reading a gzipped stream, use
Loads an entire stream of Ion data into a single datagram, detecting whether it's text or binary data.load(IonReader)instead.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- ifionDatais null.IonException- if there's a syntax error in the Ion content.java.io.IOException- if reading from the specified input stream results in anIOException.
-
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- ifreaderis null.IonException- if there's a syntax error in the Ion content.
-
-