Hi Herwig,
Thanks for your help.
Herwig Hochleitner writes:
(defn copy-multi
([input outputs] (copy-multi input outputs (make-array Byte/TYPE 1024)))
([^java.io.InputStream input outputs buffer]
(let [size (.read input buffer)]
(when (pos? size)
(doseq
Streaming simultaneously can result in all kinds of problems due
differences in speed and reliablility between a disk and network
connection. So if you can, buffer the data for the write to S3. Maybe you
could just stream to S3 from the file after you've written it?
If you must stream
Sorry, I mistakenly pressed the send shortcut in gmail. The
modified-version of io/copy is:
(defn copy-multi
([input outputs] (copy-multi input outputs (make-array Byte/TYPE 1024)))
([^java.io.InputStream input outputs buffer]
(let [size (.read input buffer)]
(when (pos? size)
The typehint of output should be ^java.io.OutputStream, sorry.
Also to your use case:
If you don't actually want to stream simultanously, you need to write the
data into a buffer and later stream from that.
Sorry again for the whopping triple post.
--
You received this message because you are