diff options
author | Aaron Bedra <aaron@aaronbedra.com> | 2010-11-28 11:27:17 -0500 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2010-11-28 11:32:28 -0500 |
commit | 460ba9ba5c6dd4df728316f934a38498da901e8c (patch) | |
tree | 091c294dfc0925e6ba20a79c6aa897aaebb3acd8 | |
parent | aa7d26336faff6ccc65e4405e28e471221f35fc4 (diff) |
Revert accidental slurp changes that snuck in with #441
Signed-off-by: Rich Hickey <richhickey@gmail.com>
-rw-r--r-- | src/clj/clojure/core.clj | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index d55d5bf4..ed240193 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -5870,11 +5870,14 @@ {:added "1.0"} ([f & opts] (let [opts (normalize-slurp-opts opts) - sb (StringBuilder.) - sw (java.io.StringWriter.)] + sb (StringBuilder.)] (with-open [#^java.io.Reader r (apply jio/reader f opts)] - (jio/copy r sw) - (str sw))))) + (loop [c (.read r)] + (if (neg? c) + (str sb) + (do + (.append sb (char c)) + (recur (.read r))))))))) (defn spit "Opposite of slurp. Opens f with writer, writes content, then |