byte-streams

bytes=

(bytes= a b)

Returns true if the two byte streams are equivalent.

compare-bytes

(compare-bytes a b)

Returns a comparison result for two byte streams.

conversion-cost

(conversion-cost x dst)

Returns the estimated cost of converting the data x to the destination type dst.

conversion-path

(conversion-path src dst)

conversions

convert

(convert x dst)(convert x dst options)

Converts x, if possible, into type dst, which can be either a class or protocol. If no such conversion is possible, an IllegalArgumentException is thrown. If x is a stream, then the src type must be explicitly specified.

options is a map, whose available settings depend on what sort of transform is being performed:

chunk-size - if a stream is being transformed into a sequence of discrete chunks, :chunk-size describes the size of the chunks, which default to 4096 bytes.

encoding - if a string is being encoded or decoded, :encoding describes the charset that is used, which defaults to ‘UTF-8’

direct? - if a byte-buffer is being allocated, :direct? describes whether it should be a direct buffer, defaulting to false

def-conversion

macro

(def-conversion [src dst :as conversion] params & body)

Defines a conversion from one type to another.

def-transfer

macro

(def-transfer [src dst] params & body)

Defines a byte transfer from one type to another.

dev-null

Web-scale.

inverse-conversions

optimized-transfer?

(optimized-transfer? type-descriptor sink-type)

Returns true if an optimized transfer function exists for the given source and sink objects.

possible-conversions

(possible-conversions src)

Returns a list of all possible conversion targets from value.

print-bytes

(print-bytes bytes)

Prints out the bytes in both hex and ASCII representations, 16 bytes per line.

seq-of

(seq-of x)

src->dst->transfer

stream-of

(stream-of x)

to-byte-array

(to-byte-array x)(to-byte-array x options)

Converts the object to a byte-array.

to-byte-arrays

(to-byte-arrays x)(to-byte-arrays x options)

Converts the object to a byte-array.

to-byte-buffer

(to-byte-buffer x)(to-byte-buffer x options)

Converts the object to a java.nio.ByteBuffer.

to-byte-buffers

(to-byte-buffers x)(to-byte-buffers x options)

Converts the object to a sequence of java.nio.ByteBuffer.

to-byte-sink

(to-byte-sink x)(to-byte-sink x options)

Converts the object to something that satisfies ByteSink.

to-byte-source

(to-byte-source x)(to-byte-source x options)

Converts the object to something that satisfies ByteSource.

to-char-sequence

(to-char-sequence x)(to-char-sequence x options)

Converts to the object to a java.lang.CharSequence.

to-data-input-stream

(to-data-input-stream x)(to-data-input-stream x options)

to-input-stream

(to-input-stream x)(to-input-stream x options)

Converts the object to a java.io.InputStream.

to-line-seq

(to-line-seq x)(to-line-seq x options)

Converts the object to a lazy sequence of newline-delimited strings.

to-output-stream

(to-output-stream x)(to-output-stream x options)

Converts the object to a java.io.OutputStream.

to-readable-channel

(to-readable-channel x)(to-readable-channel x options)

Converts the object to a java.nio.ReadableByteChannel

to-reader

(to-reader x)(to-reader x options)

Converts the object to a java.io.Reader.

to-string

(to-string x)(to-string x options)

Converts the object to a string.

transfer

(transfer source sink)(transfer source sink options)(transfer source source-type sink options)

Transfers, if possible, all bytes from source into sink. If this cannot be accomplished, an IllegalArgumentException is thrown.

options is a map whose available settings depends on the source and sink types:

chunk-size - if a stream is being transformed into a sequence of discrete chunks, :chunk-size describes the size of the chunks, which default to 4096 bytes.

encoding - if a string is being encoded or decoded, :encoding describes the charset that is used, which defaults to ‘UTF-8’

append? - if a file is being written to, :append? determines whether the bytes will overwrite the existing content or be appended to the end of the file. This defaults to true.

close? - whether the sink should be closed once the transfer is done, defaults to true.

type-descriptor

(type-descriptor x)

Returns a descriptor of the type of the given instance.

vector-of

(vector-of x)