taoensso.nippy documentation

Simple, high-performance Clojure serialization library. Originally adapted
from Deep-Freeze.

->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.

custom-readers

extend-freeze

macro

(extend-freeze type custom-type-id [x stream] & 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-stream]
  (.writeUTF [data-output-stream] (:data x)))

extend-thaw

macro

(extend-thaw custom-type-id [stream] & body)
Alpha - subject to change.
Extends Nippy to support thawing of a custom type with id ∈[1, 128]:
(extend-thaw 1 [data-input-stream]
  (->MyType (.readUTF data-input-stream)))

freeze

(freeze x & [{:keys [password compressor encryptor legacy-mode], :or {compressor snappy-compressor, encryptor aes128-encryptor}}])
Serializes arg (any Clojure data type) to a byte array. Set :legacy-mode to
true to produce bytes readable by Nippy < 2.x. For custom types extend the
Clojure reader or see `extend-freeze`.

freeze-to-bytes

(freeze-to-bytes x & {:keys [compress?], :or {compress? true}})
DEPRECATED: Use `freeze` instead.

freeze-to-stream!

(freeze-to-stream! data-output-stream x & _)
Low-level API. Serializes arg (any Clojure data type) to a DataOutputStream.

freeze-to-stream*

(freeze-to-stream* this stream)

id-bigdec

id-bigint

id-boolean

id-byte

id-bytes

id-char

id-date

id-double

id-float

id-integer

id-keyword

id-list

id-long

id-map

id-meta

id-nil

id-old-keyword

id-old-map

id-old-reader

id-old-string

id-queue

id-ratio

id-reader

id-record

id-reserved

id-seq

id-serializable

id-set

id-short

id-sorted-map

id-sorted-set

id-string

id-uuid

id-vector

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.

thaw

(thaw ba & [{:keys [password compressor encryptor legacy-opts], :or {legacy-opts {:compressed? true}, compressor snappy-compressor, encryptor aes128-encryptor}, :as opts}])
Deserializes a frozen object from given byte array to its original Clojure
data type. Supports data frozen with current and all previous versions of
Nippy. For custom types extend the Clojure reader or see `extend-thaw`.

thaw-from-bytes

(thaw-from-bytes ba & {:keys [compressed?], :or {compressed? true}})
DEPRECATED: Use `thaw` instead.

thaw-from-stream!

(thaw-from-stream! data-input-stream & _)
Low-level API. Deserializes a frozen object from given DataInputStream to its
original Clojure data type.

write-id

macro

(write-id s id)