Liking cljdoc? Tell your friends :D

alphabase.bytes

Functions to generically handle byte arrays.

Functions to generically handle byte arrays.
raw docstring

byte-arrayclj/s

(byte-array length)

Creates a new array to hold byte data.

Creates a new array to hold byte data.
sourceraw docstring

byte-seqclj/s

(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.
sourceraw docstring

bytes=clj/s

(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.
sourceraw docstring

bytes?clj/s

(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.
sourceraw docstring

compareclj/s

(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.
sourceraw docstring

concatclj/s

(concat & arrs)

Concatenate bytes arrays into a single new byte array.

Concatenate bytes arrays into a single new byte array.
sourceraw docstring

copyclj/s

(copy src)
(copy src dst dst-offset)
(copy src src-offset dst dst-offset length)

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.
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.
sourceraw docstring

copy-sliceclj/s

(copy-slice src offset)
(copy-slice src offset len)

Copy a slice (defined by offset, length) from a byte array.

Omitting the slice len argument will copy remainder of src array from offset (e.g, (- (alength src) offset) bytes).

Copy a slice (defined by offset, length) from a byte array.

Omitting the slice `len` argument will copy remainder of
`src` array from offset (e.g, `(- (alength src) offset)` bytes).
sourceraw docstring

from-byteclj/s

(from-byte x)

Coerces a byte value to a number.

Coerces a byte value to a number.
sourceraw docstring

get-byteclj/s

(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.
sourceraw docstring

init-bytesclj/s

(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.
sourceraw docstring

random-bytesclj/s

(random-bytes length)

Returns a byte array length bytes long with random content.

Returns a byte array `length` bytes long with random content.
sourceraw docstring

set-byteclj/s

(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.
sourceraw docstring

to-byteclj/s

(to-byte x)

Coerces a number to a byte value.

Coerces a number to a byte value.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close