File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change 77 [clojure.java.io :as io]
88 [clojure.string :as string])
99 (:import
10- (java.io EOFException InputStream OutputStream)))
10+ (java.io
11+ EOFException
12+ IOException
13+ InputStream
14+ OutputStream)))
1115
1216(set! *warn-on-reflection* true )
1317
7276(defn ^:private read-header-line
7377 " Reads a line of input. Blocks if there are no messages on the input."
7478 [^InputStream input]
75- (let [s (java.lang.StringBuilder. )]
76- (loop []
77- (let [b (.read input)] ; ; blocks, presumably waiting for next message
78- (case b
79- -1 ::eof ; ; end of stream
80- #_lf 10 (str s) ; ; finished reading line
81- #_cr 13 (recur ) ; ; ignore carriage returns
82- (do (.append s (char b)) ; ; byte == char because header is in US-ASCII
83- (recur )))))))
79+ (try
80+ (let [s (java.lang.StringBuilder. )]
81+ (loop []
82+ (let [b (.read input)] ; ; blocks, presumably waiting for next message
83+ (case b
84+ -1 ::eof ; ; end of stream
85+ #_lf 10 (str s) ; ; finished reading line
86+ #_cr 13 (recur ) ; ; ignore carriage returns
87+ (do (.append s (char b)) ; ; byte == char because header is in US-ASCII
88+ (recur ))))))
89+ (catch IOException _e
90+ ::eof )))
8491
8592(defn input-stream->input-chan
8693 " Returns a channel which will yield parsed messages that have been read off
You can’t perform that action at this time.
0 commit comments