Liking cljdoc? Tell your friends :D

clj-commons.format.binary

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

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

*fonts*clj

Mapping from byte category to a font (color).

Mapping from byte category to a font (color).
sourceraw 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, java.nio.ByteBuffer, java.lang.String, java.lang.StringBuilder, 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, java.nio.ByteBuffer, java.lang.String, java.lang.StringBuilder, 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 print-binary-delta and returns the result as a string.

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

(print-binary data)
(print-binary data options)

Formats a BinaryData 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:

  • 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.              |

When ANSI is enabled, the individual bytes and characters are color-coded as per the *fonts*.

Formats a BinaryData 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:

- [[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.              |

When ANSI is enabled, the individual bytes and characters are color-coded as per the [[*fonts*]].
sourceraw docstring

(print-binary-delta 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