On Nov 19, 5:51 pm, prhlava <[EMAIL PROTECTED]> wrote:
> (. ofile write (str
>                                            (char (bit-shift-right pix 16))
>                                            (char (bit-shift-right pix 8))
>                                            (char pix)))
>                            )
>

Dealing with byte-arrays, you will want to use the write-method that
takes an array, not the one that takes a string.

Constructing the array is a bit tricky:

; Define your int
(def pix 652187261)

; Define your array, typed as array of char
(def payload
  (into-array Character/TYPE [(char (bit-shift-right pix 16))
                              (char (bit-shift-right pix 8))
                              (char pix)]))

; Create your FileWriter
(def ofile (java.io.FileWriter. "somefile.bin"))

; Write and close
(.write ofile payload)
(.close ofile)


--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to