BytesHexFormat

Common
JVM
JS
Native
1.0
class BytesHexFormat
(source)

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.

Types

Common
JVM
JS
Native
1.0

Builder

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

class Builder

Properties

Common
JVM
JS
Native
1.0

bytePrefix

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

val bytePrefix: String
Common
JVM
JS
Native
1.0

byteSeparator

The string used to separate adjacent bytes in a group.

val byteSeparator: String
Common
JVM
JS
Native
1.0

bytesPerGroup

The maximum number of bytes per group.

val bytesPerGroup: Int
Common
JVM
JS
Native
1.0

bytesPerLine

The maximum number of bytes per line.

val bytesPerLine: Int
Common
JVM
JS
Native
1.0

byteSuffix

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

val byteSuffix: String
Common
JVM
JS
Native
1.0

groupSeparator

The string used to separate adjacent groups in a line.

val groupSeparator: String

Functions

Common
JVM
JS
Native
1.0

toString

Returns a string representation of the object.

fun toString(): String