Liking cljdoc? Tell your friends :D

io.aviso.binary

Utilities for formatting binary data (byte arrays) or binary deltas.

Utilities for formatting binary data (byte arrays) or binary deltas.
raw docstring

BinaryDatacljprotocol

Allows various data sources to be treated as a byte-array data type that supports a length and random access to individual bytes.

BinaryData is extended onto byte arrays, onto String, and onto nil.

Allows various data sources to be treated as a byte-array data type that
supports a length and random access to individual bytes.

BinaryData is extended onto byte arrays, onto `String`, and onto nil.

byte-atclj

(byte-at this index)

The byte value at a specific offset.

The byte value at a specific offset.

data-lengthclj

(data-length this)

The total number of bytes available.

The total number of bytes available.
sourceraw docstring

format-binaryclj

(format-binary data)
(format-binary data options)

Formats the data using write-binary and returns the result as a string.

Formats the data using [[write-binary]] and returns the result as a string.
sourceraw docstring

format-binary-deltaclj

(format-binary-delta expected actual)

Formats the delta using write-binary-delta and returns the result as a string.

Formats the delta using [[write-binary-delta]] and returns the result as a string.
sourceraw docstring

write-binaryclj

(write-binary data)
(write-binary writer data)
(write-binary writer data options)

Formats a ByteData into a hex-dump string, consisting of multiple lines; each line formatted as:

0000: 43 68 6F 6F 73 65 20 69 6D 6D 75 74 61 62 69 6C 69 74 79 2C 20 61 6E 64 20 73 65 65 20 77 68 65
0020: 72 65 20 74 68 61 74 20 74 61 6B 65 73 20 79 6F 75 2E

The full version specifies:

  • [[StringWriter]] to which to write output

  • BinaryData to write

  • option keys and values:

    :ascii - boolean : true to enable ASCII mode

    :line-bytes - number : number of bytes per line (defaults to 16 for ASCII, 32 otherwise)

In ASCII mode, the output is 16 bytes per line, but each line includes the ASCII printable characters:

0000: 43 68 6F 6F 73 65 20 69 6D 6D 75 74 61 62 69 6C |Choose immutabil|
0010: 69 74 79 2C 20 61 6E 64 20 73 65 65 20 77 68 65 |ity, and see whe|
0020: 72 65 20 74 68 61 74 20 74 61 6B 65 73 20 79 6F |re that takes yo|
0030: 75 2E                                           |u.              |

A placeholder character (a space with magenta background) is used for any non-printable character.

Formats a ByteData into a hex-dump string, consisting of multiple lines; each line formatted as:

    0000: 43 68 6F 6F 73 65 20 69 6D 6D 75 74 61 62 69 6C 69 74 79 2C 20 61 6E 64 20 73 65 65 20 77 68 65
    0020: 72 65 20 74 68 61 74 20 74 61 6B 65 73 20 79 6F 75 2E

The full version specifies:

- [[StringWriter]] to which to write output
- [[BinaryData]] to write
- option keys and values:

    :ascii - boolean
    : true to enable ASCII mode

    :line-bytes - number
    : number of bytes per line (defaults to 16 for ASCII, 32 otherwise)

In ASCII mode, the output is 16 bytes per line, but each line includes the ASCII printable characters:

    0000: 43 68 6F 6F 73 65 20 69 6D 6D 75 74 61 62 69 6C |Choose immutabil|
    0010: 69 74 79 2C 20 61 6E 64 20 73 65 65 20 77 68 65 |ity, and see whe|
    0020: 72 65 20 74 68 61 74 20 74 61 6B 65 73 20 79 6F |re that takes yo|
    0030: 75 2E                                           |u.              |

A placeholder character (a space with magenta background) is used for any non-printable
character.
sourceraw docstring

write-binary-deltaclj

(write-binary-delta expected actual)
(write-binary-delta writer expected actual)

Formats a hex dump of the expected data (on the left) and actual data (on the right). Bytes that do not match are highlighted in green on the expected side, and red on the actual side. When one side is shorter than the other, it is padded with -- placeholders to make this more clearly visible.

expected and actual are BinaryData.

Display 16 bytes (from each data set) per line.

Formats a hex dump of the expected data (on the left) and actual data (on the right). Bytes
that do not match are highlighted in green on the expected side, and red on the actual side.
When one side is shorter than the other, it is padded with `--` placeholders to make this
more clearly visible.

expected and actual are [[BinaryData]].

Display 16 bytes (from each data set) per line.
sourceraw docstring

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

× close