Add a new JsonGenerator
write method variant, writeStartArray(int count)
#127
Milestone
JsonGenerator
write method variant, writeStartArray(int count)
#127
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.The text was updated successfully, but these errors were encountered: