On Feb 27, 8:02 am, Stuart Sierra wrote:
> On Feb 26, 3:04 pm, Martin DeMello wrote:
>
> > Is there a quick way to read a file into a java array of bytes?
>
> You want Apache Commons IO:http://commons.apache.org/io/
>
> Specifically,http://tinyurl.com/cytspt
Ah, beautiful! Thanks a lot.
martin
On Feb 27, 8:01 am, Chouser wrote:
>
> Seriously, what's with this API? I give up.
Yeah, I spent an hour or so sifting through nio before throwing up my
hands :) Also, (getBytes (slurp file)) sounded like it would work, but
it does charset encoding.
martin
--~--~-~--~~~
On Feb 26, 3:04 pm, Martin DeMello wrote:
> Is there a quick way to read a file into a java array of bytes?
You want Apache Commons IO:
http://commons.apache.org/io/
Specifically, http://tinyurl.com/cytspt
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this
On Thu, Feb 26, 2009 at 3:04 PM, Martin DeMello wrote:
>
> Is there a quick way to read a file into a java array of bytes?
(let [fl (java.io.File. "/tmp/datafile")
ary (make-array Byte/TYPE (.length fl))]
(with-open [strm (java.io.FileInputStream. fl)]
(.read strm ary 0 (.length fl))
Is there a quick way to read a file into a java array of bytes?
martin
--~--~-~--~~~---~--~~
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 fro