reading gzipped files

169 views
Skip to first unread message

Jay Donnell

unread,
Mar 18, 2011, 3:50:00 PM3/18/11
to clj-la
I don't recall who asked about this last night, but here is some
clojure code to read gzipped files.

(import '[java.util.zip GZIPInputStream])
(import '[java.io FileInputStream])
(use 'clojure.contrib.io)
(line-seq (reader (GZIPInputStream. (FileInputStream. "somefile"))))

If you want to read it from a byte array instead of a file use
ByteArrayInputStream instead of FileInputStream and pass it your bytes.
Reply all
Reply to author
Forward
0 new messages