 
   The default date format (in UTC) is: yyyy-MM-dd'T'HH:mm:ss'Z'"
   ([obj]
-     (generate-cbor obj nil))
+   (generate-cbor obj nil))
   ([obj opt-map]
-     (let [baos (ByteArrayOutputStream.)
-           generator (.createJsonGenerator ^CBORFactory
-                                           (or factory/*cbor-factory*
-                                               factory/cbor-factory)
-                                           baos)]
-       (gen/generate generator obj (or (:date-format opt-map)
-                                       factory/default-date-format)
-                     (:ex opt-map)
-                     (:key-fn opt-map))
-       (.flush generator)
-       (.toByteArray baos))))
+   (let [baos (ByteArrayOutputStream.)
+         generator (.createGenerator ^CBORFactory
+                                     (or factory/*cbor-factory*
+                                         factory/cbor-factory)
+                                     ^OutputStream baos)]
+     (gen/generate generator obj (or (:date-format opt-map)
+                                     factory/default-date-format)
+                   (:ex opt-map)
+                   (:key-fn opt-map))
+     (.flush generator)
+     (.toByteArray baos))))
 
 ;; Parsers
 (defn parse-string


  The default date format (in UTC) is: yyyy-MM-dd'T'HH:mm:ss'Z'"
  ([obj ^BufferedWriter writer]
     (generate-stream obj writer nil))
  ([obj ^BufferedWriter writer opt-map]
     (let [generator (.createJsonGenerator
                      ^JsonFactory (or factory/*json-factory*
                                       factory/json-factory) writer)]
       (when (:pretty opt-map)
         (.useDefaultPrettyPrinter generator))
       (when (:escape-non-ascii opt-map)
         (.enable generator JsonGenerator$Feature/ESCAPE_NON_ASCII))
       (gen/generate generator obj (or (:date-format opt-map)
                                       factory/default-date-format)
                     (:ex opt-map)
                     (:key-fn opt-map))
       (.flush generator)
       writer)))

(defn create-generator [writer]
  "Returns JsonGenerator for given writer."
  (.createJsonGenerator
   ^JsonFactory (or factory/*json-factory*
                    factory/json-factory) writer))

(def ^:dynamic ^JsonGenerator *generator*)
(def ^:dynamic *opt-map*)


  The default date format (in UTC) is: yyyy-MM-dd'T'HH:mm:ss'Z'"
  ([obj]
   (generate-smile obj nil))
  ([obj opt-map]
   (let [baos (ByteArrayOutputStream.)
         generator (.createGenerator ^SmileFactory
                                     (or factory/*smile-factory*
                                         factory/smile-factory)
                                     ^OutputStream baos)]
     (gen/generate generator obj (or (:date-format opt-map)
                                     factory/default-date-format)
                   (:ex opt-map)
                   (:key-fn opt-map))
     (.flush generator)
     (.toByteArray baos))))

(defn generate-cbor
  "Returns a CBOR-encoded byte-array for the given Clojure object.
