Hi Islon,

Records already implement java.io.Serializable. So this is working:

(ns record-serialization)

(defrecord R [x y])

(defn test-serialization
  []
  (with-open [oos (java.io.ObjectOutputStream.
(java.io.FileOutputStream. "tmp"))]
    (.writeObject oos (R. 12 42)))
  (with-open [ois (java.io.ObjectInputStream.
(java.io.FileInputStream. "tmp"))]
    (let [r (.readObject ois)]
      [r (:x r) (:y r)])))

user=> (record-serialization/test-serialization)
[#:record-serialization.R{:x 12, :y 42} 12 42]

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

Reply via email to