1.2.0 permalink Arrow_down_16x16

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/io.clj:121 top

(defprotocol Streams
  (reader [x]
    "Attempts to coerce its argument into an open java.io.Reader.
     The default implementations of this protocol always return a
     java.io.BufferedReader.

     Default implementations are provided for Reader, BufferedReader,
     InputStream, File, URI, URL, Socket, byte arrays, character arrays,
     and String.

     If argument is a String, it tries to resolve it first as a URI, then
     as a local file name.  URIs with a 'file' protocol are converted to
     local file names.  If this fails, a final attempt is made to resolve
     the string as a resource on the CLASSPATH.

     Uses *default-encoding* as the text encoding.

     Should be used inside with-open to ensure the Reader is properly
     closed.")
  (writer [x]
    "Attempts to coerce its argument into an open java.io.Writer.
     The default implementations of this protocol always return a
     java.io.BufferedWriter.

     Default implementations are provided for Writer, BufferedWriter,
     OutputStream, File, URI, URL, Socket, and String.

     If the argument is a String, it tries to resolve it first as a URI, then
     as a local file name.  URIs with a 'file' protocol are converted to
     local file names.

     Should be used inside with-open to ensure the Writer is properly
     closed.")
  (input-stream [x]
    "Attempts to coerce its argument into an open java.io.InputStream.
     The default implementations of this protocol always return a
     java.io.BufferedInputStream.

     Default implementations are defined for OutputStream, File, URI, URL,
     Socket, byte array, and String arguments.

     If the argument is a String, it tries to resolve it first as a URI, then
     as a local file name.  URIs with a 'file' protocol are converted to
     local file names.

     Should be used inside with-open to ensure the InputStream is properly
     closed.")
  (output-stream [x]
    "Attempts to coerce its argument into an open java.io.OutputStream.
     The default implementations of this protocol always return a
     java.io.BufferedOutputStream.

     Default implementations are defined for OutputStream, File, URI, URL,
     Socket, and String arguments.

     If the argument is a String, it tries to resolve it first as a URI, then
     as a local file name.  URIs with a 'file' protocol are converted to
     local file names.

     Should be used inside with-open to ensure the OutputStream is
     properly closed."))
Vars in clojure.contrib.io/Streams: defprotocol
Used in 0 other vars

Comments top

No comments for Streams. Log in to add a comment.