cljam.util

General utilities.

as-url

(as-url x)

basename

(basename x)

bytes->string

(bytes->string b)

compressor-input-stream

(compressor-input-stream f)
Returns a compressor input stream from f, autodetecting the compressor type
from the first few bytes of f. Returns java.io.BufferedInputStream if the
compressor type is not known. Should be used inside with-open to ensure the
InputStream is properly closed.

compressor-output-stream

(compressor-output-stream f)(compressor-output-stream f k)
Returns a compressor output stream from `f` and a compressor type `k`. `k`
must be selected from `:bgzip`, `:gzip` or `:bzip2`. Autodetects the
compressor type from the extension of `f` if `k` is not passed. Returns
`java.io.BufferedOutputStream` if the compressor type is not known. Should be
used inside with-open to ensure the OutputStream is properly closed.

create-temp-dir

(create-temp-dir prefix)
Returns a created temporary directory with the given `prefix`.

delete-temp-dir!

(delete-temp-dir! dir)
Takes the temporary directory created by `create-temp-dir` and deletes the
`dir` and the files in `dir`.

graph?

(graph? c)
Returns true if c is a visible character, false if not.

space?

(space? c)
Returns true if c is a character that creates "white space" in displayed
text.

string->bytes

(string->bytes s)

ubyte

(ubyte n)
Casts to byte avoiding an error about out of range for byte.

with-temp-dir

macro

(with-temp-dir bindings & body)
bindings => [dir prefix ...]
Creates a temporary directory with the given `prefix` and binds the given
`dir` to it. Finally, deletes `dir` and the files in `dir`.