ring.util.io

Utility functions for handling I/O.

close!

added in 1.2

(close! stream)
Ensure a stream is closed, swallowing any exceptions.

last-modified-date

added in 1.2

(last-modified-date file)
Returns the last modified date for a file, rounded down to the nearest
second.

piped-input-stream

added in 1.1

(piped-input-stream func)
Create an input stream from a function that takes an output stream as its
argument. The function will be executed in a separate thread. The stream
will be automatically closed after the function finishes.

For example:

  (piped-input-stream
    (fn [ostream]
      (spit ostream "Hello")))

string-input-stream

added in 1.1

(string-input-stream s)(string-input-stream s encoding)
Returns a ByteArrayInputStream for the given String.