Top Description Fields Constructors Methods
com.amazon.ion.impl

pack-priv Class IonWriterUser

extends _Private_IonWriterBase
implements _Private_IonWriter
Class Inheritance
All Implemented Interfaces
com.amazon.ion.impl._Private_IonWriter, com.amazon.ion.IonWriter, com.amazon.ion.facet.Faceted, java.io.Flushable, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
com.amazon.ion.impl.IonWriterUserBinary
Static Imports
com.amazon.ion.SystemSymbols.ION_SYMBOL_TABLE

This writer handles the symbol table processing and provides default implementations for the list forms of the write methods as often the list form is not susceptible to optimization.

This writer has a (_system_writer) to which the actual data is written, but data flows through the _current_writer most of the time.

The critical responsibility here is the recognition of IVMs and local symbol tables. When the user starts writing a local symtab, the stream is diverted away from the _system_writer into a temporary tree writer that collects the symtab data into an IonStruct instance. When that struct is stepped-out, the diversion is stopped and the new SymbolTable is installed.

Field Summary

Modifier and TypeField and Description
private final IonCatalog
_catalog

Used to make correct local symbol tables.

pack-priv IonWriterSystem
_current_writer

This will be either our _system_writer or a symbol table writer depending on whether we're diverting the user values to a local symbol table ...

private IonStruct
_symbol_table_value

While the stream is diverted to collect local symtab data, it is being written to this instance.

private final ValueFactory
_symtab_value_factory

Factory for constructing the DOM of local symtabs.

pack-priv final IonWriterSystem
_system_writer

The underlying system writer that writing the raw format (text, binary, or ion values).

Inherited from com.amazon.ion.impl._Private_IonWriterBase:
ERROR_FINISH_NOT_AT_TOP_LEVELERROR_MISSING_FIELD_NAME

Constructor Summary

AccessConstructor and Description
pack-priv
IonWriterUser(IonCatalog
may be null.
catalog
,
ValueFactory
must not be null.
symtabValueFactory
,
IonWriterSystem
must not be null.
systemWriter
,
boolean requireSymbolValidation)

Base constructor.

pack-priv
IonWriterUser(IonCatalog
may be null
catalog
,
ValueFactory
must not be null
symtabValueFactory
,
IonWriterSystem
must not be null
systemWriter
,
SymbolTable
must not be null
symtab
,
boolean requireSymbolValidation)

Constructor for text and binary writers.

Method Summary

Modifier and TypeMethod and Description
pack-priv SymbolTable
public void
addTypeAnnotation(String
string annotation to append to the annotation list
annotation
)

Implements com.amazon.ion.IonWriter.addTypeAnnotation.

Adds a given string to the list of pending annotations.

pack-priv final String
assumeKnownSymbol(int sid)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.assumeKnownSymbol.

Translates a symbol using the current symtab.

public void
close()

Implements com.amazon.ion.IonWriter.close.

Closes this stream and releases any system resources associated with it.

private void
close_local_symbol_table_copy()

Closes the diverted writer since the local symbol table is complete (i.e. the struct is closed, on stepOut()).

pack-priv int
findAnnotation(String
the annotation to find.
name
)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.findAnnotation.

Returns the given annotation's index in the value's annotations list, or -1 if not present.

public final void
finish()

Implements com.amazon.ion.IonWriter.finish.

Indicates that writing is completed and all buffered data should be written and flushed as if this were the end of the Ion data stream.

public void
flush()

Implements com.amazon.ion.IonWriter.flush.

Flushes this writer by writing any buffered output to the underlying output target without finalizing the stream's local symbol table.

public IonCatalog
getCatalog()

Implements com.amazon.ion.impl._Private_IonWriter.getCatalog.

Mostly for testing at this point, but could be useful public API.

public int
getDepth()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.getDepth.

Implements com.amazon.ion.impl._Private_IonWriter.getDepth.

Returns the current depth of containers the writer is at.

public final SymbolTable
getSymbolTable()

Implements com.amazon.ion.IonWriter.getSymbolTable.

Gets the symbol table that is currently in use by the writer.

pack-priv int[]
getTypeAnnotationIds()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.getTypeAnnotationIds.

Gets the current list of pending annotations.

pack-priv String[]
getTypeAnnotations()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.getTypeAnnotations.

Gets the current list of pending annotations.

pack-priv final SymbolToken[]
public final boolean
isFieldNameSet()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.isFieldNameSet.

Implements com.amazon.ion.impl._Private_IonWriter.isFieldNameSet.

Returns true if the field name has been set either through setFieldName or setFieldId.

public boolean
isInStruct()

Implements com.amazon.ion.IonWriter.isInStruct.

Determines whether values are being written as fields of a struct.

private void
open_local_symbol_table_copy()

Diverts the data stream to a temporary tree writer which collects local symtab data into an IonStruct from which we'll later construct a SymbolTable instance.

public final void
setFieldName(String
text of the field name
name
)

Implements com.amazon.ion.IonWriter.setFieldName.

Sets the pending field name to the given text.

public final void
setFieldNameSymbol(SymbolToken
text of the field name
name
)

Implements com.amazon.ion.IonWriter.setFieldNameSymbol.

Sets the pending field name to the given token.

public final void
setSymbolTable(SymbolTable
base symbol table for encoding. Must not be null.
symbols
)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.setSymbolTable.

Sets the symbol table to use for encoding to be the passed in symbol table.

public void
setTypeAnnotations(String...
string array with the annotations. If null or empty, any pending annotations are cleared.
annotations
)

Implements com.amazon.ion.IonWriter.setTypeAnnotations.

Sets the full list of pending annotations to the given text symbols.

public void
setTypeAnnotationSymbols(SymbolToken...
If null or empty, any pending annotations are cleared.
annotations
)

Implements com.amazon.ion.IonWriter.setTypeAnnotationSymbols.

Sets the full list of pending annotations to the given symbols.

public void
stepIn(IonType containerType)

Implements com.amazon.ion.IonWriter.stepIn.

Writes the beginning of a non-null container (list, sexp, or struct).

public void
stepOut()

Implements com.amazon.ion.IonWriter.stepOut.

Writes the end of the current container, returning this writer to the context of parent container.

private boolean
public void
writeBlob(byte[]
bytes to be written. May be null to represent null.blob.
value
,
int
offset of the first byte in value to write
start
,
int
number of bytes to write from value
len
)

Implements com.amazon.ion.IonWriter.writeBlob.

Writes a portion of the byte array out as an IonBlob value.

public void
writeBool(boolean
true or false as desired
value
)

Implements com.amazon.ion.IonWriter.writeBool.

writes a non-null boolean value (true or false) as an IonBool to output.

public void
writeClob(byte[]
bytes to be written. May be null to represent null.clob.
value
,
int
offset of the first byte in value to write
start
,
int
number of bytes to write from value
len
)

Implements com.amazon.ion.IonWriter.writeClob.

Writes a portion of the byte array out as an IonClob value.

public void
writeDecimal(BigDecimal
may be null to represent null.decimal.
value
)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.writeDecimal.

Implements com.amazon.ion.IonWriter.writeDecimal.

Writes a BigDecimal value as an Ion decimal.

public void
writeFloat(double
double to write
value
)

Implements com.amazon.ion.IonWriter.writeFloat.

writes a 64 bit binary floating point value, a Java double, as an IonFloat.

public void
writeInt(int value)

public void
writeInt(long
signed int to write
value
)

Implements com.amazon.ion.IonWriter.writeInt.

writes a signed 64 bit value, a Java long, as an IonInt.

public void
writeInt(BigInteger
BigInteger to write
value
)

Implements com.amazon.ion.IonWriter.writeInt.

writes a BigInteger value as an IonInt.

pack-priv final void
public final void
public void
writeNull(IonType
type of the null to be written
type
)

Implements com.amazon.ion.IonWriter.writeNull.

Writes a null value of a specified Ion type.

public void
writeString(String
may be null to represent null.string.
value
)

Implements com.amazon.ion.IonWriter.writeString.

Writes a java.lang.String as an Ion string.

pack-priv final void
writeSymbol(int
symbol table id to write
symbolId
)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.writeSymbol.

Write symbolId out as an IonSymbol value.

public final void
writeSymbol(String
may be null to represent null.symbol.
value
)

Implements com.amazon.ion.IonWriter.writeSymbol.

Writes the text of an Ion symbol value.

public void
writeTimestamp(Timestamp
may be null to represent null.timestamp.
value
)

Implements com.amazon.ion.IonWriter.writeTimestamp.

Writes a timestamp value.

Inherited from com.amazon.ion.impl._Private_IonWriterBase:
asFacetisStreamCopyOptimizedpop_passed_symbol_tablevalidateSymbolIdwriteBlobwriteClobwriteFloatwriteNullwriteSymbolTokenwriteTimestampUTCwriteValuewriteValuewriteValueRecursivelywriteValues

Field Detail

_catalogback to summary
private final IonCatalog _catalog

Used to make correct local symbol tables. May be null.

_current_writerback to summary
pack-priv IonWriterSystem _current_writer

This will be either our _system_writer or a symbol table writer depending on whether we're diverting the user values to a local symbol table ... or not. Not null.

_symbol_table_valueback to summary
private IonStruct _symbol_table_value

While the stream is diverted to collect local symtab data, it is being written to this instance. This is null IFF _current_writer == _system_writer.

_symtab_value_factoryback to summary
private final ValueFactory _symtab_value_factory

Factory for constructing the DOM of local symtabs. Not null.

_system_writerback to summary
pack-priv final IonWriterSystem _system_writer

The underlying system writer that writing the raw format (text, binary, or ion values). Not null.

Constructor Detail

IonWriterUserback to summary
pack-priv IonWriterUser(IonCatalog catalog, ValueFactory symtabValueFactory, IonWriterSystem systemWriter, boolean requireSymbolValidation)

Base constructor.

POSTCONDITION: IonWriterUser#_system_writer == _current_writer == systemWriter

Parameters
catalog:IonCatalog

may be null.

symtabValueFactory:ValueFactory

must not be null.

systemWriter:IonWriterSystem

must not be null.

IonWriterUserback to summary
pack-priv IonWriterUser(IonCatalog catalog, ValueFactory symtabValueFactory, IonWriterSystem systemWriter, SymbolTable symtab, boolean requireSymbolValidation)

Constructor for text and binary writers.

POSTCONDITION: IonWriterUser#_system_writer == _current_writer == systemWriter

Parameters
catalog:IonCatalog

may be null

symtabValueFactory:ValueFactory

must not be null

systemWriter:IonWriterSystem

must not be null

symtab:SymbolTable

must not be null

Method Detail

activeSystemSymbolTableback to summary
pack-priv SymbolTable activeSystemSymbolTable()
addTypeAnnotationback to summary
public void addTypeAnnotation(String annotation)

Implements com.amazon.ion.IonWriter.addTypeAnnotation.

Doc from com.amazon.ion.IonWriter.addTypeAnnotation.

Adds a given string to the list of pending annotations.

The list of pending annotations is cleared when the current value is written via stepIn() or one of the write*() methods.

Parameters
annotation:String

string annotation to append to the annotation list

assumeKnownSymbolback to summary
pack-priv final String assumeKnownSymbol(int sid)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.assumeKnownSymbol.

Doc from com.amazon.ion.impl._Private_IonWriterBase.assumeKnownSymbol.

Translates a symbol using the current symtab.

Returns:String

not null.

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements com.amazon.ion.IonWriter.close.

Doc from com.amazon.ion.IonWriter.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

If the cursor is between top-level values, this method will finish() before closing the underlying output stream. If not, the resulting data may be incomplete and invalid Ion.

In other words: unless you're recovering from a failure condition, don't close the writer until you've stepped-out back to the starting level.

Exceptions
IOException:
if thrown by the underlying output target.
close_local_symbol_table_copyback to summary
private void close_local_symbol_table_copy() throws IOException

Closes the diverted writer since the local symbol table is complete (i.e. the struct is closed, on stepOut()).

findAnnotationback to summary
pack-priv int findAnnotation(String name)

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.findAnnotation.

Doc from com.amazon.ion.impl._Private_IonWriterBase.findAnnotation.

Returns the given annotation's index in the value's annotations list, or -1 if not present.

Parameters
name:String

the annotation to find.

Returns:int

the index or -1.

Annotations
@Override
finishback to summary
public final void finish() throws IOException

Implements com.amazon.ion.IonWriter.finish.

Doc from com.amazon.ion.IonWriter.finish.

Indicates that writing is completed and all buffered data should be written and flushed as if this were the end of the Ion data stream. For example, an Ion binary writer will finalize any local symbol table, write all top-level values, and then flush.

This method may only be called when all top-level values are completely written and stepped-out.

Implementations should allow the application to continue writing further top-level values following the semantics for concatenating Ion data streams. If another top-level value is written, the result must behave as if it were preceded by an Ion version marker, resetting the stream context as if this were a new stream. (Whether or not an IVM is written may depend upon the writer's configuration; see IvmMinimizing.)

This feature can be used to flush buffered data and reset the local symbol table before writing more values. Applications that produce long streams of binary Ion may wish to finish occasionally to relieve memory pressure, then continue writing data using a new local symbol table. This is particularly useful for streams that contain an ever-growing number of unique symbols to avoid unbounded growth of the symbol table, which may degrade performance and bloat the encoding. Applications that produce long streams with a limited number of unique symbols should enable localSymbolTableAppend (see com.amazon.ion.system.IonBinaryWriterBuilder#withLocalSymbolTableAppendEnabled) and flush() instead to avoid re-declaring the local symbol table unnecessarily.

Exceptions
IOException:
if thrown by the underlying output target.
flushback to summary
public void flush() throws IOException

Implements com.amazon.ion.IonWriter.flush.

Doc from com.amazon.ion.IonWriter.flush.

Flushes this writer by writing any buffered output to the underlying output target without finalizing the stream's local symbol table.

For some implementations this may have no effect even when some data is buffered, because it's not always possible to fully write partial data. In particular, when writing binary Ion data, Ion's length-prefixed encoding requires a complete top-level value to be written at once.

If localSymbolTableAppend is enabled (see com.amazon.ion.system.IonBinaryWriterBuilder#withLocalSymbolTableAppendEnabled), this feature can be used to flush buffered data before writing more values without subsequently having to redeclare the current local symbol table. Applications that produce long streams of binary Ion may wish to flush occasionally to relieve memory pressure, then continue writing data using the same local symbol table. The symbol table will be appended with newly-encountered symbols as necessary.

Exceptions
IOException:
if thrown by the underlying output target.
getCatalogback to summary
public IonCatalog getCatalog()

Implements com.amazon.ion.impl._Private_IonWriter.getCatalog.

Doc from com.amazon.ion.impl._Private_IonWriter.getCatalog.

Mostly for testing at this point, but could be useful public API.

getDepthback to summary
public int getDepth()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.getDepth.

Implements com.amazon.ion.impl._Private_IonWriter.getDepth.

Doc from com.amazon.ion.impl._Private_IonWriter.getDepth.

Returns the current depth of containers the writer is at. This is 0 if the writer is at top-level.

Returns:int

int depth of container nesting

Annotations
@Override
getSymbolTableback to summary
public final SymbolTable getSymbolTable()

Implements com.amazon.ion.IonWriter.getSymbolTable.

Doc from com.amazon.ion.IonWriter.getSymbolTable.

Gets the symbol table that is currently in use by the writer. While writing a number of values the symbol table will be populated with any added symbols.

Note that the table may be replaced during processing. For example, the stream may start out with a system table that's later replaced by a local table in order to store newly-encountered symbols.

When this method returns a local table, it may be mutable, meaning that additional symbols may be interned until it is made read-only. Note that manually mutating local symbol tables is a deprecated feature; please instead use IonSystem#newBinaryWriter(java.io.OutputStream, SymbolTable...) or IonSystem#newTextWriter(java.io.OutputStream, SymbolTable...) to provide custom symbol table(s) to writers upon construction.

Returns:SymbolTable

current symbol table

getTypeAnnotationIdsback to summary
pack-priv int[] getTypeAnnotationIds()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.getTypeAnnotationIds.

Doc from com.amazon.ion.impl._Private_IonWriterBase.getTypeAnnotationIds.

Gets the current list of pending annotations. This is the contents of the current annotations array of this writer.

If the annotations were set as string they will be converted to symbol IDs (ints) if a symbol table is available. In the event a symbol table is not available a null array will be returned. If no annotations are set a 0 length array will be returned.

Returns:int[]

pending type annotations as symbol ID ints, null if the annotations cannot be expressed as IDs.

Annotations
@Override
getTypeAnnotationsback to summary
pack-priv String[] getTypeAnnotations()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.getTypeAnnotations.

Doc from com.amazon.ion.impl._Private_IonWriterBase.getTypeAnnotations.

Gets the current list of pending annotations. This is the contents of the current annotations array of this writer.

If the annotations were set as IDs they will be converted if a symbol table is available. In the event a symbol table is not available a null array will be returned. If no annotations are set a 0 length array will be returned.

Returns:String[]

pending type annotations as strings, null if the annotations cannot be expressed as strings.

Annotations
@Override
getTypeAnnotationSymbolsback to summary
pack-priv final SymbolToken[] getTypeAnnotationSymbols()
isFieldNameSetback to summary
public final boolean isFieldNameSet()

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.isFieldNameSet.

Implements com.amazon.ion.impl._Private_IonWriter.isFieldNameSet.

Doc from com.amazon.ion.impl._Private_IonWriter.isFieldNameSet.

Returns true if the field name has been set either through setFieldName or setFieldId. This is generally more efficient than calling getFieldName or getFieldId and checking the return type as it does not need to resolve the name through a symbol table. This returns false if the field name has not been set.

Returns:boolean

true if a field name has been set false otherwise

Annotations
@Override
isInStructback to summary
public boolean isInStruct()

Implements com.amazon.ion.IonWriter.isInStruct.

Doc from com.amazon.ion.IonWriter.isInStruct.

Determines whether values are being written as fields of a struct. This is especially useful when it is not clear whether field names need to be written or not.

Returns:boolean

true when the parent is a struct.

open_local_symbol_table_copyback to summary
private void open_local_symbol_table_copy()

Diverts the data stream to a temporary tree writer which collects local symtab data into an IonStruct from which we'll later construct a SymbolTable instance.

Once the value image of the symbol table is complete (which happens when the caller steps out of the containing struct) the diverted stream is abandonded and the symbol table gets constructed.

If there was a makeSymbolTable(Reader) this copy might be, at least partially, avoided.

setFieldNameback to summary
public final void setFieldName(String name)

Implements com.amazon.ion.IonWriter.setFieldName.

Doc from com.amazon.ion.IonWriter.setFieldName.

Sets the pending field name to the given text.

The pending field name is cleared when the current value is written via stepIn() or one of the write*() methods.

Parameters
name:String

text of the field name

setFieldNameSymbolback to summary
public final void setFieldNameSymbol(SymbolToken name)

Implements com.amazon.ion.IonWriter.setFieldNameSymbol.

Doc from com.amazon.ion.IonWriter.setFieldNameSymbol.

Sets the pending field name to the given token.

The pending field name is cleared when the current value is written via stepIn() or one of the write*() methods.

Parameters
name:SymbolToken

text of the field name

setSymbolTableback to summary
public final void setSymbolTable(SymbolTable symbols) throws IOException

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.setSymbolTable.

Doc from com.amazon.ion.impl._Private_IonWriterBase.setSymbolTable.

Sets the symbol table to use for encoding to be the passed in symbol table. The can only be done between top-level values. As symbols are written this symbol table is used to resolve them. If the symbols are undefined this symbol table is updated to include them as local symbols. The updated symbol table will be written before any of the local values are emitted.

If the symbol table is the system symbol table an Ion version marker will be written to the output. If symbols not in the system symbol table are written a local symbol table will be created and written before the current top level value.

Parameters
symbols:SymbolTable

base symbol table for encoding. Must not be null.

Annotations
@Override
setTypeAnnotationsback to summary
public void setTypeAnnotations(String... annotations)

Implements com.amazon.ion.IonWriter.setTypeAnnotations.

Doc from com.amazon.ion.IonWriter.setTypeAnnotations.

Sets the full list of pending annotations to the given text symbols. Any pending annotations are cleared. The contents of the annotations array are copied into this writer, so the caller does not need to preserve the array.

The list of pending annotations is cleared when the current value is written via stepIn() or one of the write*() methods.

Parameters
annotations:String[]

string array with the annotations. If null or empty, any pending annotations are cleared.

setTypeAnnotationSymbolsback to summary
public void setTypeAnnotationSymbols(SymbolToken... annotations)

Implements com.amazon.ion.IonWriter.setTypeAnnotationSymbols.

Doc from com.amazon.ion.IonWriter.setTypeAnnotationSymbols.

Sets the full list of pending annotations to the given symbols. Any pending annotations are cleared. The contents of the annotations array are copied into this writer, so the caller does not need to preserve the array.

The list of pending annotations is cleared when the current value is written via stepIn() or one of the write*() methods.

This is an "expert method": correct use requires deep understanding of the Ion binary format. You almost certainly don't want to use it.

Parameters
annotations:SymbolToken[]

If null or empty, any pending annotations are cleared.

stepInback to summary
public void stepIn(IonType containerType) throws IOException

Implements com.amazon.ion.IonWriter.stepIn.

Doc from com.amazon.ion.IonWriter.stepIn.

Writes the beginning of a non-null container (list, sexp, or struct). This must be matched by a call to stepOut() after the last child value.

This method is not used to write null.list et al. To write null values use writeNull(IonType).

Parameters
containerType:IonType

must be one of IonType#LIST, IonType#SEXP, or IonType#STRUCT.

stepOutback to summary
public void stepOut() throws IOException

Implements com.amazon.ion.IonWriter.stepOut.

Doc from com.amazon.ion.IonWriter.stepOut.

Writes the end of the current container, returning this writer to the context of parent container. Invocation of this method must match a preceding call to stepIn(IonType).

symbol_table_being_collectedback to summary
private boolean symbol_table_being_collected()
writeBlobback to summary
public void writeBlob(byte[] value, int start, int len) throws IOException

Implements com.amazon.ion.IonWriter.writeBlob.

Doc from com.amazon.ion.IonWriter.writeBlob.

Writes a portion of the byte array out as an IonBlob value. This copies the portion of the byte array that is written.

Parameters
value:byte[]

bytes to be written. May be null to represent null.blob.

start:int

offset of the first byte in value to write

len:int

number of bytes to write from value

writeBoolback to summary
public void writeBool(boolean value) throws IOException

Implements com.amazon.ion.IonWriter.writeBool.

Doc from com.amazon.ion.IonWriter.writeBool.

writes a non-null boolean value (true or false) as an IonBool to output.

Parameters
value:boolean

true or false as desired

writeClobback to summary
public void writeClob(byte[] value, int start, int len) throws IOException

Implements com.amazon.ion.IonWriter.writeClob.

Doc from com.amazon.ion.IonWriter.writeClob.

Writes a portion of the byte array out as an IonClob value. This copies the porition of the byte array that is written.

Parameters
value:byte[]

bytes to be written. May be null to represent null.clob.

start:int

offset of the first byte in value to write

len:int

number of bytes to write from value

writeDecimalback to summary
public void writeDecimal(BigDecimal value) throws IOException

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.writeDecimal.

Implements com.amazon.ion.IonWriter.writeDecimal.

Doc from com.amazon.ion.IonWriter.writeDecimal.

Writes a BigDecimal value as an Ion decimal. Ion uses an arbitrarily long sign/value and an arbitrarily long signed exponent to write the value. This preserves all of the BigDecimal digits, the number of significant digits.

To write a negative zero value, pass this method a Decimal instance.

Parameters
value:BigDecimal

may be null to represent null.decimal.

Annotations
@Override
writeFloatback to summary
public void writeFloat(double value) throws IOException

Implements com.amazon.ion.IonWriter.writeFloat.

Doc from com.amazon.ion.IonWriter.writeFloat.

writes a 64 bit binary floating point value, a Java double, as an IonFloat. Currently IonFloat values are output as 64 bit IEEE 754 big endian values. IonFloat preserves all valid floating point values, including -0.0, Nan and +/-infinity. It does not guarantee preservation of -Nan or other less less "common" values.

Parameters
value:double

double to write

writeIntback to summary
public void writeInt(int value) throws IOException
Annotations
@SuppressWarnings:cast
writeIntback to summary
public void writeInt(long value) throws IOException

Implements com.amazon.ion.IonWriter.writeInt.

Doc from com.amazon.ion.IonWriter.writeInt.

writes a signed 64 bit value, a Java long, as an IonInt.

Parameters
value:long

signed int to write

writeIntback to summary
public void writeInt(BigInteger value) throws IOException

Implements com.amazon.ion.IonWriter.writeInt.

Doc from com.amazon.ion.IonWriter.writeInt.

writes a BigInteger value as an IonInt. If the BigInteger value is null this writes a null int.

Parameters
value:BigInteger

BigInteger to write

writeIonVersionMarkerback to summary
pack-priv final void writeIonVersionMarker(SymbolTable systemSymtab) throws IOException
writeIonVersionMarkerback to summary
public final void writeIonVersionMarker() throws IOException

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.writeIonVersionMarker.

Implements com.amazon.ion.impl._Private_IonWriter.writeIonVersionMarker.

Doc from com.amazon.ion.impl._Private_IonWriter.writeIonVersionMarker.

Write an Ion version marker symbol to the output. This is the $ion_1_0 value currently (in later versions the number may change). In text output this appears as the text symbol. In binary this will be the symbol id if the writer is in a list, sexp or struct. If the writer is currently at the top level this will write the "magic cookie" value. Writing a version marker will reset the symbol table to be the system symbol table.

Annotations
@Override
writeNullback to summary
public void writeNull(IonType type) throws IOException

Implements com.amazon.ion.IonWriter.writeNull.

Doc from com.amazon.ion.IonWriter.writeNull.

Writes a null value of a specified Ion type.

Parameters
type:IonType

type of the null to be written

writeStringback to summary
public void writeString(String value) throws IOException

Implements com.amazon.ion.IonWriter.writeString.

Doc from com.amazon.ion.IonWriter.writeString.

Writes a java.lang.String as an Ion string. Since Ion strings are UTF-8 and Java Strings are Unicode 16. As such the resulting lengths may not match. In addition some Java strings are not valid as they may contain only one of the two needed surrogate code units necessary to define the Unicode code point to be output, an exception will be raised if this case is encountered.

Parameters
value:String

may be null to represent null.string.

writeSymbolback to summary
pack-priv final void writeSymbol(int symbolId) throws IOException

Implements abstract com.amazon.ion.impl._Private_IonWriterBase.writeSymbol.

Doc from com.amazon.ion.impl._Private_IonWriterBase.writeSymbol.

Write symbolId out as an IonSymbol value. The value must be valid in the symbol table.

Parameters
symbolId:int

symbol table id to write

Annotations
@Override
writeSymbolback to summary
public final void writeSymbol(String value) throws IOException

Implements com.amazon.ion.IonWriter.writeSymbol.

Doc from com.amazon.ion.IonWriter.writeSymbol.

Writes the text of an Ion symbol value.

Parameters
value:String

may be null to represent null.symbol.

writeTimestampback to summary
public void writeTimestamp(Timestamp value) throws IOException

Implements com.amazon.ion.IonWriter.writeTimestamp.

Doc from com.amazon.ion.IonWriter.writeTimestamp.

Writes a timestamp value.

Parameters
value:Timestamp

may be null to represent null.timestamp.