Skip to content

clojure.java.io/writer

View this page on ClojureDocs

Type: function Added: Clojure 1.2 Examples: 3 Runnable: 1
([x & opts])

Attempts to coerce its argument into an open java.io.Writer. Default implementations 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.

Examples

by weiyongqing123 on
by phreed on . May have evaluation errors.
by jasonmm on . May have evaluation errors.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.