Class HexUtils
java.lang.Object
org.apache.camel.converter.crypto.HexUtils
HexUtils provides utility methods for hex conversions-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbyteArrayToHexString(byte[] in) Creates a string representation of the supplied byte array in Hexidecimal formatstatic StringbyteArrayToHexString(byte[] in, int start, int length) Creates a string representation of the supplied byte array in Hexidecimal formatstatic byte[]hexToByteArray(String hexString) Convert a hex string into an array of bytes.static booleanisHexChar(char current)
-
Method Details
-
byteArrayToHexString
Creates a string representation of the supplied byte array in Hexidecimal format- Parameters:
in- the byte array to convert to a hex string.start- where to begin in the arraylength- how many bytes from the array to include in the hexidecimal representation- Returns:
- a string containing the hexidecimal representation of the requested bytes from the array
-
byteArrayToHexString
Creates a string representation of the supplied byte array in Hexidecimal format- Parameters:
in- the byte array to convert to a hex string.- Returns:
- a string containing the hexidecimal representation of the array
-
hexToByteArray
Convert a hex string into an array of bytes. The string is expected to consist entirely of valid Hex characters i.e. 0123456789abcdefABCDEF. The array is calculated by traversing the string from from left to right, ignoring whitespace. Every 2 valid hex chars will constitute a new byte for the array. If the string is uneven then it the last byte will be padded with a '0'.- Parameters:
hexString- String to be converted
-
isHexChar
public static boolean isHexChar(char current)
-