IO helpers (experimental, changes expected).
IO helpers (experimental, changes expected).
(bounded-input-stream input
size
&
{:keys [propagate-close] :or {propagate-close true}})
Creates an instance of InputStream bounded to a specified size.
Creates an instance of InputStream bounded to a specified size.
(buffered-input-stream input
&
{:keys [buffer-size]
:or {buffer-size default-buffer-size}})
(buffered-output-stream output
&
{:keys [buffer-size]
:or {buffer-size default-buffer-size}})
(bytes-input-stream data & {:keys [offset size]})
Creates an instance of unsyncronized ByteArrayInputStream instance holding the provided data.
Creates an instance of unsyncronized ByteArrayInputStream instance holding the provided data.
(bytes-output-stream & {:keys [size]})
Creates an instance of ByteArrayOutputStream.
Creates an instance of ByteArrayOutputStream.
(close! stream)
Close any AutoCloseable resource.
Close any AutoCloseable resource.
(coercible? o)
Check if the provided object can be coercible to input stream or output stream. In other workds: checks if it satisfies the jio/IOFactory protocol.
Check if the provided object can be coercible to input stream or output stream. In other workds: checks if it satisfies the jio/IOFactory protocol.
(copy! src
dst
&
{:keys [offset size buffer-size]
:or {offset 0 size -1 buffer-size default-buffer-size}})
Efficiently copy data from src
(should be instance of
InputStream) to the dst
(which should be instance of
OutputStream).
You can specify the size for delimit how much bytes should be
written to the dst
.
Efficiently copy data from `src` (should be instance of InputStream) to the `dst` (which should be instance of OutputStream). You can specify the size for delimit how much bytes should be written to the `dst`.
(data-input-stream input)
(data-input-stream? s)
Check if provided object is an instance of DataInputStream.
Check if provided object is an instance of DataInputStream.
(data-output-stream output)
(data-output-stream? s)
Check if provided object is an instance of DataOutputStream.
Check if provided object is an instance of DataOutputStream.
(input-stream x & {:as opts})
Attempts to coerce its argument into an open java.io.InputStream. Default implementations always return a java.io.BufferedInputStream.
Convenciency API, it forwards directly to the
clojure.java.io/make-input-stream
.
Attempts to coerce its argument into an open java.io.InputStream. Default implementations always return a java.io.BufferedInputStream. Convenciency API, it forwards directly to the `clojure.java.io/make-input-stream`.
(input-stream? s)
Check if provided object is an instance of InputStream.
Check if provided object is an instance of InputStream.
(output-stream x & {:as opts})
Attempts to coerce its argument into an open java.io.InputStream. Default implementations always return a java.io.BufferedInputStream.
Convenciency API, it forwards directly to the
clojure.java.io/make-output-stream
.
Attempts to coerce its argument into an open java.io.InputStream. Default implementations always return a java.io.BufferedInputStream. Convenciency API, it forwards directly to the `clojure.java.io/make-output-stream`.
(output-stream? s)
Check if provided object is an instance of OutputStream.
Check if provided object is an instance of OutputStream.
(read-as-bytes input & {:keys [size offset close] :or {close true} :as opts})
Read all data or specified size input and return a byte array.
Read all data or specified size input and return a byte array.
(reader x & {:as opts})
Attempts to coerce its argument into an open java.io.Reader. Default implementations always return a java.io.BufferedReader.
Convenciency API, it forwards directly to the
clojure.java.io/make-reader
.
Attempts to coerce its argument into an open java.io.Reader. Default implementations always return a java.io.BufferedReader. Convenciency API, it forwards directly to the `clojure.java.io/make-reader`.
(resource x)
(resource x loader)
Returns the URL for a named resource. Use the context class loader
if no loader is specified.
Convenciency API, it forwards directly to the
clojure.java.io/resource
.
Returns the URL for a named resource. Use the context class loader if no loader is specified. Convenciency API, it forwards directly to the `clojure.java.io/resource`.
(write! src dst & {:keys [size offset close] :or {close true} :as opts})
Writes content from src
to the dst
.
If dst
in an OutputStream it will be closed when copy is finished,
you can pass :close?
option with false
for avoid this behavior.
If size is provided, no more than that bytes will be written to the
dst
.
Writes content from `src` to the `dst`. If `dst` in an OutputStream it will be closed when copy is finished, you can pass `:close?` option with `false` for avoid this behavior. If size is provided, no more than that bytes will be written to the `dst`.
(write-to-file! src dst & {:as opts})
(writer x & {:as opts})
Attempts to coerce its argument into an open java.io.Writer. Default implementations always return a java.io.BufferedWriter.
Convenciency API, it forwards directly to the
clojure.java.io/make-writer
.
Attempts to coerce its argument into an open java.io.Writer. Default implementations always return a java.io.BufferedWriter. Convenciency API, it forwards directly to the `clojure.java.io/make-writer`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close