Skip to content

Add a new JsonGenerator write method variant, writeStartArray(int count) #127

@cowtowncoder

Description

@cowtowncoder

Some binary data formats require use of length-prefix for arrays (amongst other types).
Although it is possible to dynamically calculate this during writing, doing so would require buffering all contents of the array; and are especially complicated when prefix uses variable-length encoding itself.

Since one common use case for streaming generator is that of data-binding, and in that case most often actual length (in items) is actually known (for Lists, arrays -- but not always, for Iterators etc), it would make sense to allow optional passing of number of items that are to be written. Such method could just call existing writeStartArray() for formats that do not make use of information (like JSON, XML, Smile, CSV); but be made use by formats that do require (Thrift, protobuf, msgpack) or can make use (Avro, CBOR) of such information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions