Hi Stuart, I had occasion to wrap java.util.Properties. If there's interest, may be a good candidate for c.c.java-utils.
It's pasted in below, & attached in the group at http://clojure.googlegroups.com/web/props.clj Feel free to change as you see fit. Best, Perry ---- (ns props ; Convenience lib for interacting with java.util.Properties (:use [clojure.contrib.duck-streams :only (reader writer)] [clojure.contrib.java-utils :only (the-str)]) (:import (java.util Properties))) (defn props-to-map "Convert Properties to map." [p] (into {} p)) (defn map-to-props "Convert map to Properties." {:tag Properties} [m] (let [p (Properties.)] (doseq [[k v] m] (.setProperty p (the-str k) (str v))) p)) (defn read-props "Read Properties from file into map. Uses duck-streams/reader to read from file, so duck-streams/*default-encoding* determines character decoding." [file] (props-to-map (with-open [rdr (reader file)] (doto (Properties.) (.load rdr))))) (defn write-props "Write Properties from map into file. Uses duck-streams/writer to write to file, so duck-streams/*default-encoding* determines character encoding." {:tag Properties} ([m file] (write-props m file nil)) ([m file comments] (with-open [wtr (writer file)] (doto (map-to-props m) (.store wtr comments))))) --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---