Package org.eclipse.net4j.util
Class HexUtil
java.lang.Object
org.eclipse.net4j.util.HexUtil
Provides static methods that convert to and from hexadecimal string formats.
- Author:
- Eike Stepper
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendHex(StringBuilder builder, int b) Deprecated.static StringbytesToHex(byte[] bs) static StringbytesToHex(byte[] bs, int off, int length) Converts a byte array into a string of lower case hex chars.static voidbytesToHex(InputStream bs, Writer writer) static voidbytesToHexAppend(byte[] bs, int off, int length, Appendable appendable) static StringcharToHex(char ch) static StringformatByte(int b) Deprecated.static StringformatBytes(byte[] bytes) Deprecated.static voidhexToBytes(Reader s, OutputStream outputStream) static byte[]hexToBytes(String s) static voidhexToBytes(String s, byte[] out, int off) Converts a String of hex characters into an array of bytes.static byte[]hexToBytes(String s, int off) static charstatic StringidentityHashCode(Object object) static StringidentityHashCode(Object object, boolean trimLeadingZeros) static StringintToHex(int v) static StringlongToHex(long v)
-
Field Details
-
DIGITS
public static final char[] DIGITS
-
-
Method Details
-
charToHex
- Since:
- 3.22
-
hexToChar
- Since:
- 3.22
-
bytesToHex
Converts a byte array into a string of lower case hex chars.- Parameters:
bs- A byte arrayoff- The index of the first byte to readlength- The number of bytes to read.- Returns:
- the string of hex chars.
-
bytesToHexAppend
-
bytesToHex
- Since:
- 3.7
-
bytesToHex
-
hexToBytes
-
hexToBytes
-
hexToBytes
public static void hexToBytes(String s, byte[] out, int off) throws NumberFormatException, IndexOutOfBoundsException Converts a String of hex characters into an array of bytes.- Parameters:
s- A string of hex characters (upper case or lower) of even length.out- A byte array of length at least s.length()/2 + offoff- The first byte to write of the array- Throws:
NumberFormatExceptionIndexOutOfBoundsException
-
hexToBytes
- Throws:
NumberFormatException- Since:
- 3.7
-
longToHex
-
intToHex
- Since:
- 3.13
-
identityHashCode
- Since:
- 3.13
-
identityHashCode
- Since:
- 3.20
-
formatByte
Deprecated. -
formatBytes
Deprecated. -
appendHex
Deprecated.
-