| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (edn.clj)

This example Java source code file (edn.clj) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

all, clojure, copyright, eclipse, hickey, license, public, reads, returns, rich, the, when, you

The edn.clj Java example source code

;   Copyright (c) Rich Hickey. All rights reserved.
;   The use and distribution terms for this software are covered by the
;   Eclipse Public License 1.0 (
;   which can be found in the file epl-v10.html at the root of this distribution.
;   By using this software in any fashion, you are agreeing to be bound by
;   the terms of this license.
;   You must not remove this notice, or any other, from this software.

(ns ^{:doc "edn reading."
      :author "Rich Hickey"}
  (:refer-clojure :exclude [read read-string]))

(defn read
  "Reads the next object from stream, which must be an instance of or some derivee.  stream defaults to the
  current value of *in*.

  Reads data in the edn format (subset of Clojure data):

  opts is a map that can include the following keys:
  :eof - value to return on end-of-file. When not supplied, eof throws an exception.
  :readers  - a map of tag symbols to data-reader functions to be considered before default-data-readers.
              When not supplied, only the default-data-readers will be used.
  :default - A function of two args, that will, if present and no reader is found for a tag,
             be called with the tag and the value."
  {:added "1.5"}
   (read *in*))
   (read {} stream))
  ([opts stream]
     (clojure.lang.EdnReader/read stream opts)))

(defn read-string
  "Reads one object from the string s. Returns nil when s is nil or empty.

  Reads data in the edn format (subset of Clojure data):

  opts is a map as per clojure.edn/read"
  {:added "1.5"}
  ([s] (read-string {:eof nil} s))
  ([opts s] (when s (clojure.lang.EdnReader/readString s opts))))

Other Java examples (source code examples)

Here is a short list of links related to this Java edn.clj source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.