Closed crossapple closed 8 years ago
Hi there,
Here's that example rewritten to allow (much) larger strings:
(defrecord MyType [data])
(nippy/extend-freeze MyType :my-type/foo ; A unique (namespaced) type identifier
[x data-output]
(nippy/write-utf8 data-output (:data x)))
(nippy/extend-thaw :my-type/foo ; Same type id
[data-input]
(->MyType (String. (nippy/read-utf8 data-input))))
(nippy/thaw (nippy/freeze (->MyType "Joe")))
Is there a reason you're using a custom freeze though if your data is just a large map? I'd generally recommend avoiding extend-freeze
/extend-thaw
if you can.
Hi I have been using nippy to output a complete datastructure which is a very large map based on ctries. Sadly the .writeUTF that you use in the example for handling customer types is failing as there is a maximum number of characters allowed by writeUTF. Do you have any suggestions as to how I might overcome this issue. I am a fairly new clojure user.