clojurewerkz / buffy

Buffy The ByteBuffer Slayer, Clojure library for working with binary data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamic-buffer question

dvarkin opened this issue · comments

commented

Sorry for dummy question, but I can't found official mail list to write.

Why this code doesn't works?

 (let [dynamic-string-payload
        (dynamic-buffer
         (frame-type
          (frame-encoder [value]
                         length (short-type) (count value)
                         string (string-type (count value)) value)
          (frame-decoder [buffer offset]
                         length (short-type)
                         string (string-type (read length buffer offset)))
          second ;; Value Formatter
          )) ]
    (decompose  dynamic-string-payload (compose dynamic-string-payload ["super-duper-random-string" "long-ans-senseless-stringyoyoyo"]))) 

Can you be more specific? What do you expect and what actually happens?

commented

Ups, sorry. I've got an error:

lein test :only bmbets.bcoder-test/dynbuff

ERROR in (dynbuff) (core.clj:3407)
Uncaught exception, not in assertion.
expected: nil
  actual: java.lang.ClassCastException: clojurewerkz.buffy.types.ShortType cannot be cast to java.io.PushbackReader

commented

I have to write to alexp@coffeenco.de ?

No, Alex will get a notification for my comment above.

Hey, from what I see right now it's not quite clear what exactly you'd like to achieve. If you want to parse something like netstrings, I'm afraid that code won't do.. Could you describe problem in bit more detail, I'll help to write a better impl with the tools we have.

Actually, that code works for me just fine. Let's check your version?

fixed version number in readme. It should work with 1.0.0.-beta3 or 1.0.0-beta4-SNAPSHOT

1.0.0-beta3.