Created
October 6, 2014 22:38
-
-
Save kovasb/a641c42ce0bd120296cb 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
(require '[clojure.data.fressian :as fress]) | |
(require '[clojure.java.io :as io]) | |
(import 'java.util.zip.GZIPInputStream) | |
(defn fress-seq* [reader] | |
(let [x (try (fress/read-object reader) (catch Exception e :eof))] | |
(if (= :eof x) | |
(do (.close reader) nil) | |
(cons x | |
(lazy-seq (fress-seq* reader)))))) | |
(defn fress-seq [file] | |
(let [ is (GZIPInputStream. (io/input-stream (io/file file))) | |
r (fress/create-reader is)] | |
(.read is) | |
(fress-seq* r))) | |
(count (fress-seq "/Users/kovasb/data/events.fress.gzip")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment