public class IonReaderBuilder extends Object
IonReader
from the given IonCatalog
and data
source. A data source is required, while an IonCatalog is optional. If no
IonCatalog is provided, an empty SimpleCatalog
will be used.
IonReader
s parse incrementally, so syntax errors in the input data
will not be detected as side effects of any of the build
methods
in this class.
Modifier and Type | Method and Description |
---|---|
IonReader |
build(byte[] ionData)
Based on the builder's configuration properties, creates a new IonReader
instance over the given block of Ion data, detecting whether it's text or
binary data.
|
IonReader |
build(byte[] ionData,
int offset,
int length)
Based on the builder's configuration properties, creates a new IonReader
instance over the given block of Ion data, detecting whether it's text or
binary data.
|
IonReader |
build(InputStream ionData)
Based on the builder's configuration properties, creates a new IonReader
instance over the given stream of Ion data, detecting whether it's text or
binary data.
|
IonReader |
build(IonValue value)
|
IonReader |
build(Reader ionText)
Based on the builder's configuration properties, creates a new
IonReader instance over Ion text data. |
IonReader |
build(String ionText)
Based on the builder's configuration properties, creates an new
IonReader instance over Ion text data. |
IonReaderBuilder |
copy()
Creates a mutable copy of this builder.
|
IonCatalog |
getCatalog()
Gets the catalog to use when building an
IonReader , or null
if none has been manually set. |
IonReaderBuilder |
immutable()
Returns an immutable builder configured exactly like this one.
|
IonReaderBuilder |
mutable()
Returns a mutable builder configured exactly like this one.
|
protected void |
mutationCheck()
NOT FOR APPLICATION USE!
|
void |
setCatalog(IonCatalog catalog)
Sets the catalog to use when building an
IonReader . |
static IonReaderBuilder |
standard()
The standard builder of
IonReader s, with all configuration
properties having their default values. |
IonReaderBuilder |
withCatalog(IonCatalog catalog)
Declares the catalog to use when building an
IonReader ,
returning a new mutable builder the current one is immutable. |
public static IonReaderBuilder standard()
IonReader
s, with all configuration
properties having their default values.public IonReaderBuilder copy()
this
.public IonReaderBuilder immutable()
public IonReaderBuilder mutable()
protected void mutationCheck()
public IonReaderBuilder withCatalog(IonCatalog catalog)
IonReader
,
returning a new mutable builder the current one is immutable.catalog
- the catalog to use in built readers.
If null, a new SimpleCatalog
will be used.setCatalog(IonCatalog)
,
withCatalog(IonCatalog)
public void setCatalog(IonCatalog catalog)
IonReader
.catalog
- the catalog to use in built readers.
If null, a new SimpleCatalog
will be used.UnsupportedOperationException
- if this builder is immutable.getCatalog()
,
withCatalog(IonCatalog)
public IonCatalog getCatalog()
IonReader
, or null
if none has been manually set. The catalog is needed to resolve shared
symbol table imports.setCatalog(IonCatalog)
,
withCatalog(IonCatalog)
public IonReader build(byte[] ionData)
This method will auto-detect and uncompress GZIPped Ion data.
ionData
- the source of the Ion data, which may be either Ion binary
data or UTF-8 Ion text. The reader retains a reference to the array, so
its data must not be modified while the reader is active. Must not be
null.IonReader
instance; not null
.IonSystem.newReader(byte[])
public IonReader build(byte[] ionData, int offset, int length)
This method will auto-detect and uncompress GZIPped Ion data.
ionData
- the source of the Ion data, which is used only within the
range of bytes starting at offset
for len
bytes.
The data in that range may be either Ion binary data or UTF-8 Ion text.
The reader retains a reference to the array, so its data must not be
modified while the reader is active. Must not be null.offset
- must be non-negative and less than ionData.length
.length
- must be non-negative and offset+length
must not
exceed ionData.length
.IonSystem.newReader(byte[], int, int)
public IonReader build(InputStream ionData)
This method will auto-detect and uncompress GZIPped Ion data.
Because this library performs its own buffering, it's recommended that users avoid adding additional buffering to the given stream.
ionData
- the source of the Ion data, which may be either Ion binary
data or UTF-8 Ion text. Must not be null.Closeable.close()
when finished with it.IonException
- if the source throws IOException
.IonSystem.newReader(InputStream)
public IonReader build(Reader ionText)
IonReader
instance over Ion text data.
Applications should generally use build(InputStream)
whenever possible, since this library has much faster Unicode decoding
than the Java IO framework.
Because this library performs its own buffering, it's recommended that you avoid adding additional buffering to the given stream.
ionText
- the source of the Ion text data. Must not be null.IonException
- if the source throws IOException
.IonSystem.newReader(Reader)
public IonReader build(IonValue value)
IonReader
instance over an IonValue
data model. Typically
this is used to iterate over a collection, such as an IonStruct
.value
- must not be null.IonSystem.newReader(IonValue)
public IonReader build(String ionText)
IonReader
instance over Ion text data.ionText
- the source of the Ion text data. Must not be null.IonSystem.newReader(String)