- (def ^:dynamic chunk-size 17)
- (defn next-chunk [rdr]
- (let [buf (char-array chunk-size)
- s (.read rdr buf)]
- (when (pos? s)
- (java.nio.CharBuffer/wrap buf 0 s))))
- (defn chunk-seq [rdr]
- (when-let [chunk (next-chunk rdr)]
- (cons chunk (lazy-seq (chunk-seq rdr)))))
|