-
-
Save sritchie/941f9523212137c3a0ed 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
;; This version works great! The bytes match. | |
(defn input-stream | |
"Attempts to coerce the given argument to an input stream, allowing | |
for gzip format." | |
[arg] | |
(try | |
(GZIPInputStream. (io/input-stream arg)) | |
(catch java.io.IOException e | |
(io/input-stream arg)))) | |
;; this way, using the let macro, adds two random (or, at, least, unexpected) | |
;; bytes onto the front of the GZIPInputStream. | |
(defn input-stream | |
"Attempts to coerce the given argument to an input stream, allowing | |
for gzip format." | |
[arg] | |
(let [instream (io/input-stream arg)] | |
(try | |
(GZIPInputStream. instream) | |
(catch java.io.IOException e | |
instream)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment