Package aQute.lib.hex
Class Hex
- java.lang.Object
-
- aQute.lib.hex.Hex
-
public class Hex extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Hex()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
append(java.lang.Appendable sb, byte ch)
static void
append(java.lang.Appendable sb, byte[] data)
static void
append(java.lang.Appendable sb, char ch)
static void
append(java.lang.Appendable sb, int ch)
static void
append(java.lang.Appendable sb, long ch)
static void
append(java.lang.Appendable sb, short ch)
static java.lang.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 java.lang.String
format(java.nio.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(java.nio.ByteBuffer data)
Check of a buffer is classified as binary or text.static boolean
isHex(java.lang.String pub)
static boolean
isHexCharacter(char c)
static int
nibble(char c)
static char
nibble(int i)
static java.lang.String
separated(byte[] bytes, int start, int length, java.lang.String separator)
static java.lang.String
separated(byte[] bytes, java.lang.String separator)
static byte[]
toByteArray(java.lang.String string)
static java.lang.String
toHex(byte b)
static java.lang.String
toHexString(byte[] data)
-
-
-
Method Detail
-
toByteArray
public static final byte[] toByteArray(java.lang.String string)
-
toHex
public static java.lang.String toHex(byte b)
-
nibble
public static final int nibble(char c)
-
toHexString
public static final java.lang.String toHexString(byte[] data)
-
append
public static final void append(java.lang.Appendable sb, byte[] data) throws java.io.IOException
- Throws:
java.io.IOException
-
nibble
public static final char nibble(int i)
-
isHex
public static boolean isHex(java.lang.String pub)
-
isHexCharacter
public static boolean isHexCharacter(char c)
-
separated
public static java.lang.String separated(byte[] bytes, java.lang.String separator)
-
separated
public static java.lang.String separated(byte[] bytes, int start, int length, java.lang.String separator)
-
format
public static java.lang.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.- Parameters:
data
- the buffer- Returns:
- a String with the formatted data
-
format
public static java.lang.String format(java.nio.ByteBuffer data)
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
public static boolean isBinary(java.nio.ByteBuffer 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
-
append
public static void append(java.lang.Appendable sb, byte ch)
-
append
public static void append(java.lang.Appendable sb, short ch)
-
append
public static void append(java.lang.Appendable sb, char ch)
-
append
public static void append(java.lang.Appendable sb, int ch)
-
append
public static void append(java.lang.Appendable sb, long ch)
-
-