Package aQute.lib.hex
Class Hex
java.lang.Object
aQute.lib.hex.Hex
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
append
(Appendable sb, byte ch) static final void
append
(Appendable sb, byte[] data) static void
append
(Appendable sb, char ch) static void
append
(Appendable sb, int ch) static void
append
(Appendable sb, long ch) static void
append
(Appendable sb, short ch) static String
format
(byte[] data) Format a buffer to show the buffer in a table with 16 bytes per row, hex values and ascii values are shown.static String
format
(ByteBuffer data) Format a buffer to show the buffer in a table with 16 bytes per row, hex values and ascii values are shown.static boolean
isBinary
(byte[] data) Check of a buffer is classified as binary or text.static boolean
isBinary
(ByteBuffer data) Check of a buffer is classified as binary or text.static boolean
static boolean
isHexCharacter
(char c) static final int
nibble
(char c) static final char
nibble
(int i) static String
static String
static final byte[]
toByteArray
(String string) static String
toHex
(byte b) static final String
toHexString
(byte[] data)
-
Field Details
-
HEX_P
-
HEX
static final char[] HEX
-
-
Constructor Details
-
Hex
public Hex()
-
-
Method Details
-
toByteArray
-
toHex
-
nibble
public static final int nibble(char c) -
toHexString
-
append
- Throws:
IOException
-
nibble
public static final char nibble(int i) -
isHex
-
isHexCharacter
public static boolean isHexCharacter(char c) -
separated
-
separated
-
format
Format a buffer to show the buffer in a table with 16 bytes per row, hex values and ascii values are shown.- Parameters:
data
- the buffer- Returns:
- a String with the formatted data
-
format
Format a buffer to show the buffer in a table with 16 bytes per row, hex values and ascii values are shown.- Parameters:
data
- the buffer- Returns:
- a String with the formatted data
-
isBinary
public static boolean isBinary(byte[] data) Check of a buffer is classified as binary or text. We assume a file is binary of it contains a 0 byte. Heuristics may differ in the future, this method is really to collect this decision in one place.- Parameters:
data
- the buffer- Returns:
- true of classified as binary
-
isBinary
Check of a buffer is classified as binary or text. We assume a file is binary of it contains a 0 byte. Heuristics may differ in the future, this method is really to collect this decision in one place.- Parameters:
data
- the buffer- Returns:
- true of classified as binary
-
append
-
append
-
append
-
append
-
append
-