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

Creating a finite/fixed-size map #123

Open
Avamander opened this issue Nov 28, 2021 · 2 comments
Open

Creating a finite/fixed-size map #123

Avamander opened this issue Nov 28, 2021 · 2 comments
Labels
enhancement java Pull requests that update Java code waiting for next release

Comments

@Avamander
Copy link

Avamander commented Nov 28, 2021

Quite a few embedded libraries do not like indefinite-sized CBOR maps (or arrays for that matter).

For demonstration, I created a map with:

            new CborEncoder(baos).encode(new CborBuilder()
                    .startMap(4)
                    .put("Timestamp", 123456789)
                    .end()
                    .build()

and the resulting map is:

BF                         # map(*)
   69                      # text(9)
      54696D657374616D70   # "Timestamp"
   1A 075BCD15             # unsigned(123456789)

Is there a way to assemble a map that has a specified length in the end result?

c-rack added a commit that referenced this issue Nov 28, 2021
Solution: add methods to create a non-chunked map
@c-rack
Copy link
Owner

c-rack commented Nov 28, 2021

Hi @Avamander, is commit 0ef74dc what you are looking for?

@Avamander
Copy link
Author

It probably is if you're proposing it 😅 as you know your library and CBOR much better.

I could test it out specifically if at some point you'd make a release with the change incorporated, I don't know how to build this library myself.

@c-rack c-rack added enhancement java Pull requests that update Java code waiting for next release labels May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement java Pull requests that update Java code waiting for next release
Projects
None yet
Development

No branches or pull requests

2 participants