(defn read-chars
([rdr n] (read-chars rdr n false))
([#^Reader rdr n throw-exception]
(let [sb (StringBuilder.)]
(dotimes [i n]
(let [c (.read rdr)]
(if (not= c -1)
(.append sb (char c))
(when throw-exception
(throw throw-exception)))))
(str sb))))
Comments top
No comments for read-chars. Log in to add a comment.