Hi there,
I'm working on a project that involves transferring large files over
the network (100+MB) and wondering what would work better. I'm newer
to Java than I am to lisp, so I've just grabbed the most obvious
things from the API that I thought could possibly work:
(ns misc-ports
(:import
It looks like you're reading one byte at a time. Why not create a buffer and
read up to 1024 bytes at a time?
(defn write-file [ins outs]
(let [buffer (make-array Byte/TYPE 1024)]
(loop [len (.read ins buffer)]
(if (not (neg? len))
(do
(.write outs buffer 0 len)
(recur (.read ins
On May 15, 2009, at 11:10 AM, Christopher Wilson wrote:
But it turns out that this is rather slow. What would be some methods
to speed this up?
Consider using the new I/O API's in java.nio.*
From http://java.sun.com/j2se/1.5.0/docs/guide/nio :
The new I/O (NIO) APIs introduced in v 1.4
But it turns out that this is rather slow. What would be some methods
to speed this up?
You could also wrap your input and output stream's with
java.util.zip.GZIPInputStream and GZIPOutputStream to
compress/decompress the data either side. They allow you to specify
buffer sizes, so you could