On Jan 30, 2014, at 08:10 , Steffen Dienst <[email protected]> wrote:
> That's exactly what padding is designed to do: Let's say you know there is a
> run of bytes with a known length (from a header field maybe) and you want to
> parse an unbounded number of objects within this area. You could use
>
> (padding (repeated inner-codec) 1024)
Excellent.
> Currently codecs don't know about their context, that means, I can't behave
> differently depending on whether a codec is used within a padding or not,
> sorry.
It could work the other way around, with 'padding catching certain types of
exceptions thrown by its inner codecs.
For example, when parsing something like (padding (repeated (constant 0x99))
len pad-byte), padding could catch the exception thrown by the constant codec
and then use pad-byte to parse the remaining bytes.
But I can live without this, if it's too niche or too hard to implement.
> Then the docs seem to be wrong (or at least confusing), since the example
> code for 'bits says the first item corresponds to the "highest" bit.
> Thanks, I fixed the documentation.
A couple other things about the README:
The docs for 'header say that body->header should produce a codec that will be
used to encode the header, but in testing I've had to make it return the header
directly (which does make more sense).
Also, the expression #{:a :b:last} in the 'bits section is missing a space.
Thanks for all the help, by the way!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.