On 3 March 2011 14:39, finbeu <[email protected]> wrote:
> But I have right now no clue to do this (navigating to the stream
> forth by a fixed number of bytes). Is there a clojure function to do
> this or do I have to fall back to java?
You're better off falling back to Java for this. Clojure doesn't yet
have a native mechanism for handling streaming data, so the standard
Java stream classes are generally used when dealing with I/O.
However, there are a bunch of helper functions in clojure.java.io that
you'll definitely want to use.
Once you have your stream, you probably want a function like:
(defn read-bytes [stream n]
(let [bytes (byte-array n)]
(.read stream bytes)
bytes))
And then turn it into a string with:
(String. bytes "UTF-8")
- James
--
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