Merge pull request #11 from mpenet/greased
Using greased for ByteArrayIO
This commit is contained in:
commit
531a698ecf
4 changed files with 14 additions and 9 deletions
|
|
@ -5,7 +5,11 @@ Current [semantic](http://semver.org/) version:
|
||||||
[com.taoensso/nippy "2.0.0-beta1"] ; Development (notes below)
|
[com.taoensso/nippy "2.0.0-beta1"] ; Development (notes below)
|
||||||
```
|
```
|
||||||
|
|
||||||
v2 adds pluggable compression, crypto support (also pluggable), an improved API (including much better error messages), easier integration into other tools/libraries, and hugely improved performance. It **is backwards compatible**, but please note that the old `freeze-to-bytes`/`thaw-from-bytes` API has been **deprecated** in favor of `freeze`/`thaw`. **PLEASE REPORT ANY PROBLEMS!**
|
v2 adds pluggable compression, crypto support (also pluggable), an improved API (including much better error messages), easier integration into other tools/libraries, and hugely improved performance.
|
||||||
|
|
||||||
|
v2 **is backwards compatible**, but please note that the old `freeze-to-bytes`/`thaw-from-bytes` API has been **deprecated** in favor of `freeze`/`thaw`.
|
||||||
|
|
||||||
|
**PLEASE REPORT ANY PROBLEMS!**
|
||||||
|
|
||||||
# Nippy, a Clojure serialization library
|
# Nippy, a Clojure serialization library
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.4.0"]
|
:dependencies [[org.clojure/clojure "1.4.0"]
|
||||||
[expectations "1.4.43"]
|
[expectations "1.4.43"]
|
||||||
[org.iq80.snappy/snappy "0.3"]]
|
[org.iq80.snappy/snappy "0.3"]
|
||||||
|
[cc.qbits/grease "0.2.1"]]
|
||||||
:profiles {:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
|
:profiles {:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
|
||||||
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
|
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
|
||||||
:dev {:dependencies []}
|
:dev {:dependencies []}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
(utils :as utils)
|
(utils :as utils)
|
||||||
(compression :as compression :refer (snappy-compressor))
|
(compression :as compression :refer (snappy-compressor))
|
||||||
(encryption :as encryption :refer (aes128-encryptor))])
|
(encryption :as encryption :refer (aes128-encryptor))])
|
||||||
(:import [java.io DataInputStream DataOutputStream ByteArrayOutputStream
|
(:import [java.io DataInputStream DataOutputStream]
|
||||||
ByteArrayInputStream]
|
[cc.qbits.grease.io FastByteArrayInputStream FastByteArrayOutputStream]
|
||||||
[clojure.lang Keyword BigInt Ratio PersistentQueue PersistentTreeMap
|
[clojure.lang Keyword BigInt Ratio PersistentQueue PersistentTreeMap
|
||||||
PersistentTreeSet IPersistentList IPersistentVector IPersistentMap
|
PersistentTreeSet IPersistentList IPersistentVector IPersistentMap
|
||||||
IPersistentSet IPersistentCollection]))
|
IPersistentSet IPersistentCollection]))
|
||||||
|
|
@ -171,7 +171,7 @@
|
||||||
compressor snappy-compressor
|
compressor snappy-compressor
|
||||||
encryptor aes128-encryptor}}]]
|
encryptor aes128-encryptor}}]]
|
||||||
(when legacy-mode (assert-legacy-args compressor password))
|
(when legacy-mode (assert-legacy-args compressor password))
|
||||||
(let [ba (ByteArrayOutputStream.)
|
(let [ba (FastByteArrayOutputStream.)
|
||||||
stream (DataOutputStream. ba)]
|
stream (DataOutputStream. ba)]
|
||||||
(binding [*print-dup* print-dup?] (freeze-to-stream x stream))
|
(binding [*print-dup* print-dup?] (freeze-to-stream x stream))
|
||||||
(let [ba (.toByteArray ba)
|
(let [ba (.toByteArray ba)
|
||||||
|
|
@ -283,7 +283,7 @@
|
||||||
(let [ba data-ba
|
(let [ba data-ba
|
||||||
ba (if password (encryption/decrypt encryptor password ba) ba)
|
ba (if password (encryption/decrypt encryptor password ba) ba)
|
||||||
ba (if compressor (compression/decompress compressor ba) ba)
|
ba (if compressor (compression/decompress compressor ba) ba)
|
||||||
stream (DataInputStream. (ByteArrayInputStream. ba))]
|
stream (DataInputStream. (FastByteArrayInputStream. ba))]
|
||||||
(binding [*read-eval* read-eval?] (thaw-from-stream stream)))
|
(binding [*read-eval* read-eval?] (thaw-from-stream stream)))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
(cond
|
(cond
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue