Class _Private_IonBinaryWriterBuilder
-
Nested Class Summary
Nested classes/interfaces inherited from class com.amazon.ion.system.IonWriterBuilder
IonWriterBuilder.InitialIvmHandling, IonWriterBuilder.IvmMinimizing -
Method Summary
Modifier and TypeMethodDescriptionfinal IonWriterbuild(OutputStream out) Builds a new writer based on this builder's configuration properties.final IonBinaryWriterDeprecated.copy()final IonCatalogGets the catalog to use when building anIonWriter.final SymbolTable[]Gets the imports that will be used to construct the initial local symbol table.Gets the symbol table to use for encoded data.mutable()protected voidNOT FOR APPLICATION USE!voidsetCatalog(IonCatalog catalog) Sets the catalog to use when building anIonWriter.voidsetImports(SymbolTable... imports) Sets the shared symbol tables that will be used to construct the initial local symbol table.voidsetInitialSymbolTable(SymbolTable symtab) Declares the symbol table to use for encoded data.voidsetIsFloatBinary32Enabled(boolean enabled) Enables or disables writing Binary32 (4-byte, single precision, IEEE-754) values for floats when there would be no loss in precision.voidsetLocalSymbolTableAppendEnabled(boolean enabled) Enables or disables writing local symbol tables that append symbols to the current symbol table.voidsetStreamCopyOptimized(boolean optimized) Declares whether built writers may attempt to optimizeIonWriter.writeValue(IonReader)by copying raw source data.voidsetSymtabValueFactory(ValueFactory factory) standard()Disables writing Binary32 (4-byte, single precision, IEEE-754) values for floats.Enables writing Binary32 (4-byte, single precision, IEEE-754) values for floats when there would be no loss in precision.withInitialSymbolTable(SymbolTable symtab) Defaults to $ion_1_0 if null.Disables writing local symbol tables that append symbols to the current symbol table.Enables writing local symbol tables that append symbols to the current symbol table.withSymtabValueFactory(ValueFactory factory) Methods inherited from class com.amazon.ion.system.IonBinaryWriterBuilder
getInitialIvmHandling, getIvmMinimizing, isStreamCopyOptimized, withCatalog, withImports, withStreamCopyOptimized
-
Method Details
-
standard
- Returns:
- a new mutable builder.
-
copy
- Specified by:
copyin classIonBinaryWriterBuilder
-
immutable
- Specified by:
immutablein classIonBinaryWriterBuilder
-
mutable
- Specified by:
mutablein classIonBinaryWriterBuilder
-
getSymtabValueFactory
-
setSymtabValueFactory
-
withSymtabValueFactory
-
getInitialSymbolTable
Description copied from class:IonBinaryWriterBuilderGets the symbol table to use for encoded data. To avoid conflicts between different data streams, if the given instance is mutable, it will be copied whenbuild()is called.- Specified by:
getInitialSymbolTablein classIonBinaryWriterBuilder- Returns:
- a local or system symbol table.
May be null, in which case the initial symbol table is that of
$ion_1_0. - See Also:
-
setInitialSymbolTable
Declares the symbol table to use for encoded data. To avoid conflicts between different data streams, if the given instance is mutable, it will be copied whenbuild()is called.- Specified by:
setInitialSymbolTablein classIonBinaryWriterBuilder- Parameters:
symtab- must be a local or system symbol table. May be null, in which case the initial symtab is that of$ion_1_0.- Throws:
SubstituteSymbolTableException- if any imported table is a substitute (seeSymbolTable).- See Also:
-
withInitialSymbolTable
Defaults to $ion_1_0 if null.- Specified by:
withInitialSymbolTablein classIonBinaryWriterBuilder- Parameters:
symtab- may be null.
-
setLocalSymbolTableAppendEnabled
public void setLocalSymbolTableAppendEnabled(boolean enabled) Description copied from class:IonBinaryWriterBuilderEnables or disables writing local symbol tables that append symbols to the current symbol table. This functionality is disabled by default.- Specified by:
setLocalSymbolTableAppendEnabledin classIonBinaryWriterBuilder
-
withLocalSymbolTableAppendEnabled
Description copied from class:IonBinaryWriterBuilderEnables writing local symbol tables that append symbols to the current symbol table. This functionality is disabled by default.- Specified by:
withLocalSymbolTableAppendEnabledin classIonBinaryWriterBuilder
-
withLocalSymbolTableAppendDisabled
Description copied from class:IonBinaryWriterBuilderDisables writing local symbol tables that append symbols to the current symbol table. This functionality is disabled by default.- Specified by:
withLocalSymbolTableAppendDisabledin classIonBinaryWriterBuilder
-
setIsFloatBinary32Enabled
public void setIsFloatBinary32Enabled(boolean enabled) Description copied from class:IonBinaryWriterBuilderEnables or disables writing Binary32 (4-byte, single precision, IEEE-754) values for floats when there would be no loss in precision. By default Binary32 support is disabled to ensure the broadest compatibility with existing Ion implementations. Historically, implementations were only able to read Binary64 values.When enabled, floats are evaluated for a possible loss of data at single precision. If the value can be represented in single precision without data loss, it is written as a 4-byte, Binary32 value. Floats which cannot be represented as single-precision values are written as 8-byte, Binary64 values (this is the legacy behavior for all floats, regardless of value).
- Specified by:
setIsFloatBinary32Enabledin classIonBinaryWriterBuilder- Parameters:
enabled-trueto enable writing 4-byte floats,falseto always write 8-byte floats.- See Also:
-
withFloatBinary32Enabled
Description copied from class:IonBinaryWriterBuilderEnables writing Binary32 (4-byte, single precision, IEEE-754) values for floats when there would be no loss in precision. By default Binary32 support is disabled to ensure the broadest compatibility with existing Ion implementations. Historically, implementations were only able to read Binary64 values.When enabled, floats are evaluated for a possible loss of data at single precision. If the value can be represented in single precision without data loss, it is written as a 4-byte, Binary32 value. Floats which cannot be represented as single-precision values are written as 8-byte, Binary64 values (this is the legacy behavior for all floats, regardless of value).
- Specified by:
withFloatBinary32Enabledin classIonBinaryWriterBuilder- See Also:
-
withFloatBinary32Disabled
Description copied from class:IonBinaryWriterBuilderDisables writing Binary32 (4-byte, single precision, IEEE-754) values for floats. This is the default behavior.When disabled, floats are always written as 8-byte, Binary64 values regardless of value. This is the legacy behavior for all Ion binary writers and ensures the boarded compatibility with other Ion consumers.
- Specified by:
withFloatBinary32Disabledin classIonBinaryWriterBuilder- See Also:
-
setImports
Sets the shared symbol tables that will be used to construct the initial local symbol table.If the imports sequence is not null and not empty, the output stream will be bootstrapped with a local symbol table that uses the given
imports.- Parameters:
imports- a sequence of shared symbol tables. The first (and only the first) may be a system table.- See Also:
-
setCatalog
Sets the catalog to use when building anIonWriter.- Parameters:
catalog- the catalog to use in built writers. If null, the writer will be unable to resolve manually-written imports and may throw an exception.- See Also:
-
setStreamCopyOptimized
public void setStreamCopyOptimized(boolean optimized) Description copied from class:IonBinaryWriterBuilderDeclares whether built writers may attempt to optimizeIonWriter.writeValue(IonReader)by copying raw source data. By default, this property is false.This feature is experimental! Please test thoroughly and report any issues.
- Overrides:
setStreamCopyOptimizedin classIonBinaryWriterBuilder- See Also:
-
build
Description copied from class:IonWriterBuilderBuilds a new writer based on this builder's configuration properties.- Specified by:
buildin classIonWriterBuilder- Parameters:
out- the stream that will receive Ion data. Must not be null.- Returns:
- a new
IonWriterinstance; notnull.
-
buildLegacy
Deprecated. -
mutationCheck
protected void mutationCheck()NOT FOR APPLICATION USE! -
getCatalog
Gets the catalog to use when building anIonWriter. The catalog is needed to resolve manually-written imports (not common). By default, this property is null.- See Also:
-
getImports
Gets the imports that will be used to construct the initial local symbol table.- Returns:
- may be null or empty.
- See Also:
-