Package burp.mcp.util
Class ByteArrayConverter
java.lang.Object
burp.mcp.util.ByteArrayConverter
Utility for hex encoding/decoding and byte array conversion.
Montoya ByteUtils has no hex methods, so we use java.util.HexFormat (Java 17+).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToHex(byte[] data) Encode bytes as a hex string.static StringbytesToString(byte[] data) Convert bytes to a string using UTF-8 decoding.static byte[]Convert a hex string to a byte array.static byte[]Convert a string to bytes using UTF-8 encoding.static StringtoHex(byte[] data) Convert a byte array to a lowercase hex string.
-
Constructor Details
-
ByteArrayConverter
public ByteArrayConverter()
-
-
Method Details
-
toHex
Convert a byte array to a lowercase hex string. -
fromHex
Convert a hex string to a byte array.- Throws:
IllegalArgumentException- if the string is not valid hex
-
stringToBytes
Convert a string to bytes using UTF-8 encoding. -
bytesToString
Convert bytes to a string using UTF-8 decoding. Invalid sequences become U+FFFD replacements (String decoding never throws); usebytesToHex(byte[])for binary data. -
bytesToHex
Encode bytes as a hex string.
-