public abstract class _Private_IonWriterBase extends java.lang.Object implements IonWriter, _Private_ReaderWriter
Base type for Ion writers. This handles the writeIonEvents and provides default handlers for the list forms of write. This also resolves symbols if a symbol table is available (which it will not be if the underlying writer is a system writer).
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ERROR_MISSING_FIELD_NAME |
Constructor and Description |
---|
_Private_IonWriterBase(boolean requireSymbolValidation) |
Modifier and Type | Method and Description |
---|---|
<T> T |
asFacet(java.lang.Class<T> facetType)
Returns a facet of this subject if supported.
|
protected abstract int |
getDepth()
Returns the current depth of containers the writer is at.
|
abstract boolean |
isFieldNameSet()
Returns true if the field name has been set either through setFieldName or
setFieldId.
|
boolean |
isStreamCopyOptimized() |
SymbolTable |
pop_passed_symbol_table() |
abstract void |
setSymbolTable(SymbolTable symbols)
Sets the symbol table to use for encoding to be the passed
in symbol table.
|
void |
writeBlob(byte[] value)
write the byte array out as an IonBlob value.
|
void |
writeClob(byte[] value)
write the byte array out as an IonClob value.
|
abstract void |
writeDecimal(java.math.BigDecimal value)
Writes a BigDecimal value as an Ion decimal.
|
void |
writeFloat(float value) |
void |
writeNull()
Writes a value of Ion's null type (
null aka null.null ). |
void |
writeSymbolToken(SymbolToken tok)
Writes the content of an Ion symbol value.
|
void |
writeTimestampUTC(java.util.Date value)
writes the passed in Date (in milliseconds since the epoch) as an
IonTimestamp.
|
void |
writeValue(IonReader reader)
Overrides can optimize special cases.
|
void |
writeValue(IonValue value)
Deprecated.
|
void |
writeValues(IonReader reader)
Writes a reader's current value, and all following values until the end
of the current container.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTypeAnnotation, close, finish, flush, getSymbolTable, isInStruct, setFieldName, setFieldNameSymbol, setTypeAnnotations, setTypeAnnotationSymbols, stepIn, stepOut, writeBlob, writeBool, writeClob, writeFloat, writeInt, writeInt, writeNull, writeString, writeSymbol, writeTimestamp
protected static final java.lang.String ERROR_MISSING_FIELD_NAME
public _Private_IonWriterBase(boolean requireSymbolValidation)
requireSymbolValidation
- true if SID validation should be performed; otherwise, false.
See _Private_IonTextWriterBuilder.withInvalidSidsAllowed(boolean)
protected abstract int getDepth()
public abstract void setSymbolTable(SymbolTable symbols) throws java.io.IOException
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.
symbols
- base symbol table for encoding. Must not be null.java.lang.IllegalArgumentException
- if symbols is null or a shared symbol
table, or if this writer isn't at top level.java.io.IOException
public abstract boolean isFieldNameSet()
public void writeBlob(byte[] value) throws java.io.IOException
IonWriter
public void writeClob(byte[] value) throws java.io.IOException
IonWriter
public abstract void writeDecimal(java.math.BigDecimal value) throws java.io.IOException
IonWriter
To write a negative zero value, pass this method a
Decimal
instance.
writeDecimal
in interface IonWriter
value
- may be null to represent null.decimal
.java.io.IOException
public void writeFloat(float value) throws java.io.IOException
java.io.IOException
public void writeNull() throws java.io.IOException
IonWriter
null
aka null.null
).public final void writeSymbolToken(SymbolToken tok) throws java.io.IOException
IonWriter
writeSymbolToken
in interface IonWriter
tok
- may be null to represent null.symbol
.java.io.IOException
public void writeTimestampUTC(java.util.Date value) throws java.io.IOException
IonWriter
writeTimestampUTC
in interface IonWriter
value
- java.util Date holding the UTC timestamp;
may be null to represent null.timestamp
.java.io.IOException
@Deprecated public void writeValue(IonValue value) throws java.io.IOException
IonWriter
This method also writes annotations and field names (if in a struct), and performs a deep write, including the contents of any containers encountered.
writeValue
in interface IonWriter
value
- may be null, in which case this method does nothing.java.io.IOException
public void writeValues(IonReader reader) throws java.io.IOException
IonWriter
IonReader.next()
to get going.
This method iterates until IonReader.next()
returns null
and does not step out to the container
of the current cursor position.
This method also writes annotations and field names (if in a struct), and performs a deep write, including the contents of any containers encountered.
writeValues
in interface IonWriter
java.io.IOException
public boolean isStreamCopyOptimized()
public void writeValue(IonReader reader) throws java.io.IOException
writeValue
in interface IonWriter
java.io.IOException
public final SymbolTable pop_passed_symbol_table()
pop_passed_symbol_table
in interface _Private_ReaderWriter
public <T> T asFacet(java.lang.Class<T> facetType)
Faceted
asFacet
in interface Faceted
T
- The requested facet type.facetType
- The type token of the requested facet type.Facets.asFacet(Class, Faceted)
,
Facets.assumeFacet(Class, Faceted)