hexDump(format:)

Returns a hex dump of this ByteBuffer in a preferred HexDumpFormat.

ByteBuffer-hex.swift:339
func hexDump(format: ByteBuffer.HexDumpFormat) -> String

Parameters

format

HexDumpFormat to use for the dump.

hexDump provides several formats:

  • .plain — plain hex dump format with hex bytes separated by spaces, i.e. 48 65 6c 6c 6f for Hello. This format is compatible with xxd -r.

  • .plain(maxBytes: Int) — like .plain, but clipped to maximum bytes dumped.

  • .compact — plain hexd dump without whitespaces.

  • .compact(maxBytes: Int) — like .compact, but clipped to maximum bytes dumped.

  • .detailed — detailed hex dump format with both hex, and ASCII representation of the bytes. This format is compatible with what hexdump -C outputs.

  • .detailed(maxBytes: Int) — like .detailed, but clipped to maximum bytes dumped.