-
-
Save jraines/c450b8fb3bd7a6b53e4b61f653babf50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defn- process-image-zipstream [zipstream] | |
(if-let [entry (.getNextEntry zipstream)] | |
(do | |
(println (str "Unzipping " (.getName entry))) | |
(with-open [o (io/output-stream (.getName entry))] | |
(loop [c (.read zipstream)] ;read next int from stream, mutates position of zipstream (so next .read() is different) | |
(if (not= c -1) | |
(do (.write o c) | |
(recur (.read zipstream)))))) | |
(recur zipstream)))) | |
(defn walkzip [file] | |
(with-open [z (ZipInputStream. (io/input-stream file))] | |
(process-image-zipstream z))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment