By into-array default, into-array returns an array of the capital-B
Bytes (that's what the cryptic  [Ljava.lang.Byte; in the error message
means). To get an array of primitive bytes (the class being printed as
[B), you can pass the type as additional parameter
(into-array Byte/TYPE mybytes)

On Tue, Aug 10, 2010 at 6:05 PM, Piotr 'Qertoip' Włodarek
<qert...@gmail.com> wrote:
> I need to write raw bytes to the file. I do it with:
>
>    (.write (FileOutputStream "/path") bytes)
>
> ...where bytes must be of type byte[]. Please note it cannot be
> Byte[].
>
> I tried to convert my sequence with both (bytes) and/or (into-array)
> functions and got frustrated, one example:
>
>    user=> (bytes (into-array (filter #(not (= % 13)) (to-byte-array
> (File. "e:/vpn.bat")))))
>    java.lang.ClassCastException: [Ljava.lang.Byte; cannot be cast to
> [B (NO_SOURCE_FILE:0)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
http://jgre.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to