default.txt 282 B

1234567891011
  1. (def ^:dynamic chunk-size 17)
  2. (defn next-chunk [rdr]
  3. (let [buf (char-array chunk-size)
  4. s (.read rdr buf)]
  5. (when (pos? s)
  6. (java.nio.CharBuffer/wrap buf 0 s))))
  7. (defn chunk-seq [rdr]
  8. (when-let [chunk (next-chunk rdr)]
  9. (cons chunk (lazy-seq (chunk-seq rdr)))))