taoensso.nippy documentation
Simple, high-performance Clojure serialization library. Originally adapted
from Deep-Freeze.
*final-freeze-fallback*
Alpha - subject to change.
->Compressable-LZMA2
(->Compressable-LZMA2 value)
Positional factory function for class taoensso.nippy.Compressable-LZMA2.
->StressRecord
(->StressRecord data)
Positional factory function for class taoensso.nippy.StressRecord.
Freezable
Be careful about extending to interfaces, Ref. http://goo.gl/6gGRlU.
extend-freeze
macro
(extend-freeze type custom-type-id [x out] & body)
Alpha - subject to change.
Extends Nippy to support freezing of a custom type (ideally concrete) with
id ∈[1, 128]:
(defrecord MyType [data])
(extend-freeze MyType 1 [x data-output]
(.writeUTF [data-output] (:data x)))
extend-thaw
macro
(extend-thaw custom-type-id [in] & body)
Alpha - subject to change.
Extends Nippy to support thawing of a custom type with id ∈[1, 128]:
(extend-thaw 1 [data-input]
(->MyType (.readUTF data-input)))
freeze
(freeze x & [{:keys [password compressor encryptor skip-header?], :or {compressor snappy-compressor, encryptor aes128-encryptor}, :as opts}])
Serializes arg (any Clojure data type) to a byte array. For custom types
extend the Clojure reader or see `extend-freeze`.
freeze-fallback-as-str
(freeze-fallback-as-str x out)
Alpha-subject to change.
freeze-to-bytes
(freeze-to-bytes x & {:keys [compress?], :or {compress? true}})
DEPRECATED: Use `freeze` instead.
freeze-to-out!
(freeze-to-out! data-output x & _)
Low-level API. Serializes arg (any Clojure data type) to a DataOutput.
freeze-to-out*
(freeze-to-out* this out)
freeze-to-stream!
DEPRECATED: Use `freeze-to-out!` instead.
inspect-ba
(inspect-ba ba & [thaw-opts])
Alpha - subject to change.
map->Compressable-LZMA2
(map->Compressable-LZMA2 m__5665__auto__)
Factory function for class taoensso.nippy.Compressable-LZMA2, taking a map of keywords to field values.
map->StressRecord
(map->StressRecord m__5665__auto__)
Factory function for class taoensso.nippy.StressRecord, taking a map of keywords to field values.
stress-data
Reference data used for tests & benchmarks.
stress-data-benchable
Reference data with stuff removed that breaks reader or other utils we'll
be benching against.
stress-data-comparable
Reference data with stuff removed that breaks roundtrip equality.
thaw
(thaw ba & [{:keys [password compressor encryptor headerless-meta], :or {compressor snappy-compressor, encryptor aes128-encryptor, headerless-meta {:version 1, :compressed? true, :encrypted? false}}, :as opts}])
Deserializes a frozen object from given byte array to its original Clojure
data type. By default[1] supports data frozen with current and all previous
versions of Nippy. For custom types extend the Clojure reader or see
`extend-thaw`.
[1] :headerless-meta provides a fallback facility for data frozen without a
standard Nippy header (notably all Nippy v1 data). A default is provided for
Nippy v1 thaw compatibility, but it's recommended that you _disable_ this
fallback (`{:headerless-meta nil}`) if you're certain you won't be thawing
headerless data.thaw-from-bytes
(thaw-from-bytes ba & {:keys [compressed?], :or {compressed? true}})
DEPRECATED: Use `thaw` instead.
thaw-from-in!
(thaw-from-in! data-input & _)
Low-level API. Deserializes a frozen object from given DataInput to its
original Clojure data type.
thaw-from-stream!
DEPRECATED: Use `thaw-from-in!` instead.
when-debug-mode
macro
(when-debug-mode & body)
write-id
macro
(write-id out id)