Functions to generically handle byte arrays.
Functions to generically handle byte arrays.
(byte-array length)
Creates a new array to hold byte data.
Creates a new array to hold byte data.
(byte-seq array)
Return a sequence of the bytes in an array, after coercion.
Return a sequence of the bytes in an array, after coercion.
(bytes= a b)
Returns true if two byte sequences are the same length and have the same byte content.
Returns true if two byte sequences are the same length and have the same byte content.
(bytes? x)
True if the argument is a byte array compatible with this library.
True if the argument is a byte array compatible with this library.
(compare a b)
Lexicographically compares two byte-arrays for order. Returns a negative
number, zero, or a positive number if a
is less than, equal to, or greater
than b
, respectively.
This ranking compares each byte in the keys in order; the first byte which
differs determines the ordering; if the byte in a
is less than the byte in
b
, a
ranks before b
, and vice versa.
If the keys differ in length, and all the bytes in the shorter key match the longer key, the shorter key ranks first.
Lexicographically compares two byte-arrays for order. Returns a negative number, zero, or a positive number if `a` is less than, equal to, or greater than `b`, respectively. This ranking compares each byte in the keys in order; the first byte which differs determines the ordering; if the byte in `a` is less than the byte in `b`, `a` ranks before `b`, and vice versa. If the keys differ in length, and all the bytes in the shorter key match the longer key, the shorter key ranks first.
(copy src)
(copy src dst dst-offset)
(copy src src-offset dst dst-offset length)
Copies bytes from one array to another.
length
bytes from the source at the
given offset to the destination at its offset. Returns the number of bytes
copied.Copies bytes from one array to another. - If only a source is given, returns a full copy of the byte array. - If a source and a destination with offset are given, copies all of the bytes from the source into the destination at that offset. Returns the number of bytes copied. - If all arguments are given, copies `length` bytes from the source at the given offset to the destination at its offset. Returns the number of bytes copied.
(from-byte x)
Coerces a byte value to a number.
Coerces a byte value to a number.
(get-byte array i)
Reads a byte value out of an array and coerces it to a number.
Reads a byte value out of an array and coerces it to a number.
(init-bytes values)
Initialize a new array with the given sequence of byte values.
Initialize a new array with the given sequence of byte values.
(random-bytes length)
Returns a byte array length
bytes long with random content.
Returns a byte array `length` bytes long with random content.
(set-byte array i x)
Sets a byte value in an array after coercing it from a number.
Sets a byte value in an array after coercing it from a number.
(to-byte x)
Coerces a number to a byte value.
Coerces a number to a byte value.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close