BytesHexFormat

Represents hexadecimal format options for formatting and parsing ByteArray.

When formatting one can assume that bytes are firstly separated using LF character ('\n') into lines with bytesPerLine bytes in each line. The last line may have fewer bytes. Then each line is separated into groups using groupSeparator with bytesPerGroup bytes in each group, except the last group in the line, which may have fewer bytes. All bytes in a group are separated using byteSeparator. Each byte is converted to its two-digit hexadecimal representation, immediately preceded by bytePrefix and immediately succeeded by byteSuffix.

When parsing the input string is required to be in the format described above. However, any of the char sequences CRLF, LF and CR is considered a valid line separator, and parsing is performed in case-insensitive manner.

See BytesHexFormat.Builder to find out how the options are configured, and what is the default value of each option.

Since Kotlin

1.9

Types

Link copied to clipboard
class Builder

A context for building a BytesHexFormat. Provides API for configuring format options.

Since Kotlin 1.9

Properties

Link copied to clipboard

The string that immediately precedes two-digit hexadecimal representation of each byte.

Since Kotlin 1.9
Link copied to clipboard

The string used to separate adjacent bytes in a group.

Since Kotlin 1.9
Link copied to clipboard

The maximum number of bytes per group.

Since Kotlin 1.9
Link copied to clipboard

The maximum number of bytes per line.

Since Kotlin 1.9
Link copied to clipboard

The string that immediately succeeds two-digit hexadecimal representation of each byte.

Since Kotlin 1.9
Link copied to clipboard

The string used to separate adjacent groups in a line.

Since Kotlin 1.9

Functions

Link copied to clipboard
open override fun toString(): String
Since Kotlin 1.9