Class _Private_IonWriterBase
- All Implemented Interfaces:
Faceted,_Private_ReaderWriter,IonWriter,Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
_Private_IonBinaryWriterImpl
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).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TReturns a facet of this subject if supported.protected abstract intgetDepth()Returns the current depth of containers the writer is at.abstract booleanReturns true if the field name has been set either through setFieldName or setFieldId.booleanfinal SymbolTableabstract voidsetSymbolTable(SymbolTable symbols) Sets the symbol table to use for encoding to be the passed in symbol table.voidwriteBlob(byte[] value) write the byte array out as an IonBlob value.voidwriteClob(byte[] value) write the byte array out as an IonClob value.abstract voidwriteDecimal(BigDecimal value) Writes a BigDecimal value as an Ion decimal.voidwriteFloat(float value) voidWrites a value of Ion's null type (nullakanull.null).final voidWrites the content of an Ion symbol value.voidwriteTimestampUTC(Date value) writes the passed in Date (in milliseconds since the epoch) as an IonTimestamp.voidwriteValue(IonReader reader) Overrides can optimize special cases.voidwriteValue(IonValue value) Deprecated.voidwriteValues(IonReader reader) Writes a reader's current value, and all following values until the end of the current container.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.amazon.ion.IonWriter
addTypeAnnotation, close, finish, flush, getSymbolTable, isInStruct, setFieldName, setFieldNameSymbol, setTypeAnnotations, setTypeAnnotationSymbols, stepIn, stepOut, writeBlob, writeBool, writeClob, writeFloat, writeInt, writeInt, writeNull, writeString, writeSymbol, writeTimestamp
-
Field Details
-
ERROR_MISSING_FIELD_NAME
- See Also:
-
-
Constructor Details
-
_Private_IonWriterBase
public _Private_IonWriterBase(boolean requireSymbolValidation) - Parameters:
requireSymbolValidation- true if SID validation should be performed; otherwise, false. See_Private_IonTextWriterBuilder.withInvalidSidsAllowed(boolean)
-
-
Method Details
-
getDepth
protected abstract int getDepth()Returns the current depth of containers the writer is at. This is 0 if the writer is at top-level.- Returns:
- int depth of container nesting
-
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- base symbol table for encoding. Must not be null.- Throws:
IllegalArgumentException- if symbols is null or a shared symbol table, or if this writer isn't at top level.IOException
-
isFieldNameSet
public abstract boolean 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:
- true if a field name has been set false otherwise
-
writeBlob
Description copied from interface:IonWriterwrite the byte array out as an IonBlob value. This copies the byte array.- Specified by:
writeBlobin interfaceIonWriter- Parameters:
value- may be null to representnull.blob.- Throws:
IOException
-
writeClob
Description copied from interface:IonWriterwrite the byte array out as an IonClob value. This copies the byte array.- Specified by:
writeClobin interfaceIonWriter- Parameters:
value- may be null to representnull.clob.- Throws:
IOException
-
writeDecimal
Description copied from interface:IonWriterWrites 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
Decimalinstance.- Specified by:
writeDecimalin interfaceIonWriter- Parameters:
value- may be null to representnull.decimal.- Throws:
IOException
-
writeFloat
- Throws:
IOException
-
writeNull
Description copied from interface:IonWriterWrites a value of Ion's null type (nullakanull.null).- Specified by:
writeNullin interfaceIonWriter- Throws:
IOException
-
writeSymbolToken
Description copied from interface:IonWriterWrites the content of an Ion symbol value.- Specified by:
writeSymbolTokenin interfaceIonWriter- Parameters:
tok- may be null to representnull.symbol.- Throws:
IOException
-
writeTimestampUTC
Description copied from interface:IonWriterwrites the passed in Date (in milliseconds since the epoch) as an IonTimestamp. The Date value is treated as a UTC value with an unknown timezone offset (a z value).- Specified by:
writeTimestampUTCin interfaceIonWriter- Parameters:
value- java.util Date holding the UTC timestamp; may be null to representnull.timestamp.- Throws:
IOException
-
writeValue
Deprecated.Description copied from interface:IonWriterwrites the contents of the passed in Ion value to the output.This method also writes annotations and field names (if in a struct), and performs a deep write, including the contents of any containers encountered.
- Specified by:
writeValuein interfaceIonWriter- Parameters:
value- may be null, in which case this method does nothing.- Throws:
IOException
-
writeValues
Description copied from interface:IonWriterWrites a reader's current value, and all following values until the end of the current container. If there's no current value then this method callsIonReader.next()to get going.This method iterates until
IonReader.next()returnsnulland 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.
- Specified by:
writeValuesin interfaceIonWriter- Throws:
IOException
-
isStreamCopyOptimized
public boolean isStreamCopyOptimized() -
writeValue
Overrides can optimize special cases.- Specified by:
writeValuein interfaceIonWriter- Throws:
IOException
-
pop_passed_symbol_table
- Specified by:
pop_passed_symbol_tablein interface_Private_ReaderWriter
-
asFacet
Description copied from interface:FacetedReturns a facet of this subject if supported.
-