How to use lenient mode with FasterXML CBOR?

18 Views Asked by At

I want to use the CBORGenerator.Feature.LENIENT_UTF_ENCODING enum that was introduced in version 2.12 of the jackson-dataformats-binary library. I am using version 2.16.0 of the library.

I thought I could do something like this:

CBORMapper.builder()
    .enable(CBORGenerator.Feature.LENIENT_UTF_ENCODING)
    .build();

but this gives me this error:

error: no suitable method found for enable(com.fasterxml.jackson.dataformat.cbor.CBORGenerator.Feature)
              .enable(CBORGenerator.Feature.LENIENT_UTF_ENCODING)
              ^

I tried using .configure(CBORGenerator.Feature.LENIENT_UTF_ENCODING, true) instead, but then I get this error:

error: no suitable method found for configure(com.fasterxml.jackson.dataformat.cbor.CBORGenerator.Feature,boolean)
              .configure(CBORGenerator.Feature.LENIENT_UTF_ENCODING, true)
              ^

How can I correctly create a CBORMapper instance for CBOR decoding with LENIENT_UTF_ENCODING enabled?

0

There are 0 best solutions below