Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cowtowncoder opened this issue Jan 27, 2014 · 0 comments
Closed
Milestone

Comments

@cowtowncoder
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant