Please see below.
Am Mittwoch, 29. Januar 2014 17:49:56 UTC+1 schrieb Michael Gardner:
>
> Looks good! A few questions:
>
Thanks.
> 1) Is it possible to specify a byte length for a 'repeated codec, rather
> than a number of objects?
If your 'object' is a byte,sure:
(repeated :byte :length 1234)
If you would like to use a specific codec other than :byte or :ubyte but
also restrict the number of bytes read this would only work if you expected
to have some kind of optional padding after your objects, like:
(padding inner-codec 4096).
> 2) Would you consider an enum type, for convenience? Something like:
> (defn enum [type m]
> (compile-codec type m
> (clojure.set/map-invert m)))
>
So m would be a map of for example keywords to a native datatype like int
that would allow you to represent a fixed number of things with distinct
binary representations? Looks good to me. What do you think should be the
behaviour in case of an unspecified value (not in m)?
> 3) In the mp3.clj demo, the flags seem to be listed in the wrong order. Or
> does the 'bits function actually take its arguments LSB-first?
>
Currently the index in the vector is the index of the bit. Yes, that means
LSB-first.
On Jan 29, 2014, at 06:32 , Steffen <[email protected] <javascript:>>
> wrote:
>
> > Hello Clojure community,
> >
> > there are already two excellent libraries for
> reading/writing/manipulating binary data: Zach's Lamina and Clojurewerkz'
> Buffy for java's ByteBuffers. I would like to offer another library for
> java's Input/OutputStreams. It is inspired by Lamina but not compatible in
> syntax, I'm sorry.
> > The focus is on
> > • read/write performance,
> > • no external dependencies
> > • works with java.util.*Stream
> > If you use Leiningen please add the following to your dependencies:
> >
> > [org.clojars.smee/binary "0.2.4"]
> >
> > The link to the source code and README is https://github.com/smee/binary.
>
> > Democode to parse Bitcoin blocks (including scripts):
> https://github.com/smee/binary/blob/master/src/org/clojars/smee/binary/demo/bitcoin.clj
>
> > Democode for MP3 ID3v2 tags (work in progress):
> https://github.com/smee/binary/blob/master/src/org/clojars/smee/binary/demo/mp3.clj
>
> >
> > Apart from the README, doc strings there is no further documentation,
> yet. Please refer to the demos and the unit tests for now.
> >
> > Thanks,
> >
> > Steffen Dienst
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to [email protected]<javascript:>
> > 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] <javascript:>
> > 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] <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
--
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.