-
Notifications
You must be signed in to change notification settings - Fork 63
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
feature: Add Skip() to Decoder #366
Comments
@espoal mentioned Section 4.3 of CBOR Sequences RFC 8742 which suggests a CBOR byte string can be used to wrap each item in a sequence for efficient skipping. Protocol designers can consider specifying this in their encoded format specs after considering the pros and cons. fyi: @fxamacker |
I would like to add that it would be nice to have ASN.1 implementation in go has the nice property that it returns the rest of the buffer after decoding, so you can inspect it or append the rest of the next message. |
A single byte 0x00 represents CBOR integer 0, so each byte of zero padding would be a valid CBOR data item. One way to handle padding is to create a custom io.Reader for the cbor.Decoder to strip out the padding. The handling of the padding would be defined at the protocol level.
PR #379 (yesterday) updated Decoder.Decode() so it returns One way to handle partial transmission is to check for |
thanks @fxamacker , I will try to write an example and get back to you |
Is your feature request related to a problem? Please describe.
It can be useful to skip decoding a CBOR data item as discussed in comments for issue #362.
Describe the solution you'd like
Add Skip() to the decoder to skip next data item.
Describe alternatives you've considered
As mentioned by @fxamacker
The text was updated successfully, but these errors were encountered: