Package com.amazon.ion.impl.bin

Provides the implementation for the second-generation Ion binary implementation. At this time, this is limited to a binary IonWriter.

This package limits most of its APIs to package-level access, the public API of note is contained within the _Private_IonManagedBinaryWriterBuilder which builds instances of IonManagedBinaryWriter. See the below section for what Managed means in this context.

Block API

A generalized interface for blocks of heap memory are provided via the Block API. There are two factory type APIs to actually get a Block instance: BlockAllocator which vend blocks of a particular fixed size and BlockAllocatorProvider which creates BlockAllocator instances.

The primary reason for this level of indirection is flexibility for the underlying implementations of Block and BlockAllocator. These APIs are not required to be thread-safe, whereas BlockAllocatorProvider is required to be thread-safe.

The APIs for BlockAllocator and Block follow the resource pattern (similar in principle to I/O streams), and should be closed when no longer needed to allow implementation resources to be released or re-used.

Raw Binary Ion Writer

The IonRawBinaryWriter deals with the low-level encoding considerations of the Ion format. The WriteBuffer is used closely with this implementation to deal with the Ion sub-field encodings (e.g. VarInt, VarUInt, and UTF-8).

Managed Binary Ion Writer

The IonManagedBinaryWriter is layered on top of the IonRawBinaryWriter. In particular, it intercepts symbol, annotation, field names and handles the mechanics of symbol table management transparently to the user.