or i could have just used base64:) I love leiningen +maven+central repository!
(import (java.io ByteArrayOutputStream ObjectOutputStream ByteArrayInputStream ObjectInputStream) org.apache.commons.codec.binary.Base64) (defn bytes-to-obj "convert string to object" [s] (.readObject (ObjectInputStream. (ByteArrayInputStream. s)))) (defn obj-to-bytes "convert object to string" [obj] (with-open [bos (ByteArrayOutputStream.) stream (ObjectOutputStream. bos)] (.writeObject stream obj) (.flush stream) (.toByteArray bos))) (defn encode [o] (Base64/encodeBase64String (obj-to-bytes o))) (defn decode [o] (bytes-to-obj (Base64/decodeBase64 o))) (defmethod print-dup :default [o w] (.write w (str "#=(forex.module.ea/decode \"" (encode o) "\")"))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en