Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Wolodja Wentland
On Wed, Jul 11, 2012 at 14:46 +0200, Tassilo Horn wrote: > Hm, probably yes. But you can implement the other arities quiet easily. > So that version also accepts the version that reads into a byte array. > The third version is left as an exercise for the reader. ;-) Thanks, I've done that and had

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer (kotarak)
Hi, I think you don't handle the switching of streams correctly. You have to keep track with atoms. But then you run into thread-safety issues. (defn concat-input-stream "Gets one or many input streams and returns a new input stream that concatenates the given streams." [is & streams] (l

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer (kotarak)
Hi again, talking about thread safety. Am Freitag, 13. Juli 2012 16:13:54 UTC+2 schrieb Meikel Brandmeyer (kotarak): > > (close > [] > (when @is > (.close @is) > (doseq [s @streams] (.close s (close [] (locking this (when @is (.close

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Kevin Downey
http://docs.oracle.com/javase/1.5.0/docs/api/java/io/SequenceInputStream.html On Fri, Jul 13, 2012 at 7:29 AM, Meikel Brandmeyer (kotarak) wrote: > Hi again, > > talking about thread safety. > > Am Freitag, 13. Juli 2012 16:13:54 UTC+2 schrieb Meikel Brandmeyer > (kotarak): >> >> (close >>

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Alan Malloy
(defn coll->enumeration [coll] (clojure.lang.SeqEnumeration. coll)) On Friday, July 13, 2012 7:13:54 AM UTC-7, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > I think you don't handle the switching of streams correctly. You have to > keep track with atoms. But then you run into thread-safety is

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer
Hi, Am 13.07.2012 um 19:25 schrieb Alan Malloy: > (defn coll->enumeration [coll] > (clojure.lang.SeqEnumeration. coll)) Ah. I knew there must be something. But it doesn't seem to be official, public API. Meikel signature.asc Description: Message signed with OpenPGP using GPGMail

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Kevin Downey
thank you for responding personally to me, but I sent my message to clojure google group. given the thread has the subject "Concatenating InputStreams" and I linked javadocs for a standard part of java.io that does exactly that, I am surprised that you decided to respond with "tl;dr", but I have n

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Alan Malloy
It's a public class in clojure.lang that is not used by any part of the Clojure runtime or standard libraries. I can't think what other reason it would be included for, if not to be used by you. Just like clojure.lang.PersistentQueue - there's no nice Clojure wrapper for it (why on Earth not?),

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer
Hi, Am 13.07.2012 um 23:48 schrieb Kevin Downey: > thank you for responding personally to me, but I sent my message to > clojure google group. > > given the thread has the subject "Concatenating InputStreams" and I > linked javadocs for a standard part of java.io that does exactly that, > I am s

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer
Hi, and more errata: reading is not thread-safe when the result is -1. Then an unintended switch! might happen. There things have to be packed into a locking together with a second read to verify it's still −1. Details! Details! Kind regards Meikel signature.asc Description: Message signed w