This is great. Thanks for the help.
On Dec 16, 2:55 am, Alan Malloy wrote:
> Edit: you should probably use with-open at some point, to make sure
> you close the output writer. I copied pretty badly from my own
> example :P. So more like:
>
> (let [pipe-in (PipedInputStream.)]
> (future
Edit: you should probably use with-open at some point, to make sure
you close the output writer. I copied pretty badly from my own
example :P. So more like:
(let [pipe-in (PipedInputStream.)]
(future; new thread to prevent blocking deadlock
(with-open [out (-> pipe-in (Pi
You can't really do this in a single thread without risking blocking.
But with another thread, it's fairly simple. For example, I do this in
my gzip-middleware, copying an InputStream through a pipe with GZIP
wrapping:
https://github.com/amalloy/ring-gzip-middleware/blob/master/src/ring/middleware
On Dec 16, 2:01 am, Trevor wrote:
> I have created an output stream, which appears to work fine, however
> I get an error when trying to convert the output stream into an input
> stream for use in ring:
>
> ('use [clojure.java.io :only [input-stream]])
>
> => (with-out-str (ofn var))
> "it work
I have created an output stream, which appears to work fine, however
I get an error when trying to convert the output stream into an input
stream for use in ring:
('use [clojure.java.io :only [input-stream]])
=> (with-out-str (ofn var))
"it works!"
Now when I use ring:
{:body (input-stream (ofn