FasterXML / jackson-dataformats-binary

Uber-project for standard Jackson binary format backends: avro, cbor, ion, protobuf, smile
Apache License 2.0
310 stars 133 forks source link

How to force use of Definite-Length for CBOR generation #350

Closed solita-jtn closed 1 year ago

solita-jtn commented 1 year ago

How to use Definite-Length items instead of Indefinite-length?

cowtowncoder commented 1 year ago

With CBOR module? If there was a setting to force that, it'd be in CBORGenerator.Feature. But currently I think definite length is only used for Array output where input value's length is known in advance (true for Java arrays, Lists, Sets. And possibly Maps if no filtering is done.

But anything that is serialized in a way that databind does not know in advance number of entries will use indefinite length.

There are issues that request ability to force buffering to allow Definite length for POJOs (where filtering can change number of actual property entries written) but no active work for implementing (PRs welcome etc).

cowtowncoder commented 1 year ago

Duplicate of #3 closing.