Package de.cardcontact.tlv
Class HexString
- java.lang.Object
-
- de.cardcontact.tlv.HexString
-
public class HexString extends java.lang.Object
Utility class to handle all sorts of hexadecimal string conversions- Author:
- Andreas Schwier (info@cardcontact.de)
-
-
Constructor Summary
Constructors Constructor Description HexString()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
dump(byte[] data)
Dump buffer in hexadecimal format with offset and character codesstatic java.lang.String
dump(byte[] data, int offset, int length)
Dump buffer in hexadecimal format with offset and character codes.static java.lang.String
dump(byte[] data, int offset, int length, int widths)
Dump buffer in hexadecimal format with offset and character codesstatic java.lang.String
dump(byte[] data, int offset, int length, int widths, int indent)
Dump buffer in hexadecimal format with offset and character codesstatic java.lang.String
hexifyByte(byte val)
Convert byte value to hexadecimal byte presentationstatic java.lang.String
hexifyByte(int val)
Convert integer value to hexadecimal byte presentationstatic java.lang.String
hexifyByteArray(byte[] buffer)
Convert byte array to hexadecimal stringstatic java.lang.String
hexifyByteArray(byte[] buffer, char delimiter)
Convert byte array to hexadecimal stringstatic java.lang.String
hexifyByteArray(byte[] buffer, char delimiter, int length)
Convert byte array to hexadecimal stringstatic java.lang.String
hexifyInt(int val)
Convert int value to hexadecimal int presentationstatic java.lang.String
hexifyShort(int val)
Convert int value to hexadecimal short presentationstatic byte[]
parseHexString(java.lang.String str)
Parse string of hexadecimal characters into byte array
-
-
-
Method Detail
-
hexifyByte
public static java.lang.String hexifyByte(int val)
Convert integer value to hexadecimal byte presentation- Parameters:
val
- Value- Returns:
- 2 digit hexadecimal string
-
hexifyByte
public static java.lang.String hexifyByte(byte val)
Convert byte value to hexadecimal byte presentation- Parameters:
val
- Value- Returns:
- 2 digit hexadecimal string
-
hexifyShort
public static java.lang.String hexifyShort(int val)
Convert int value to hexadecimal short presentation- Parameters:
val
- Value- Returns:
- 4 digit hexadecimal string
-
hexifyInt
public static java.lang.String hexifyInt(int val)
Convert int value to hexadecimal int presentation- Parameters:
val
- Value- Returns:
- 8 digit hexadecimal string
-
hexifyByteArray
public static java.lang.String hexifyByteArray(byte[] buffer, char delimiter, int length)
Convert byte array to hexadecimal string- Parameters:
buffer
- Buffer with bytesdelimiter
- Delimiter to be inserted between bytes. Use 0 for none.length
- Number of byte to convert- Returns:
- String with hexadecimal data
-
hexifyByteArray
public static java.lang.String hexifyByteArray(byte[] buffer, char delimiter)
Convert byte array to hexadecimal string- Parameters:
buffer
- Buffer with bytesdelimiter
- Delimiter to be inserted between bytes. Use 0 for none.- Returns:
- String with hexadecimal data
-
hexifyByteArray
public static java.lang.String hexifyByteArray(byte[] buffer)
Convert byte array to hexadecimal string- Parameters:
buffer
- Buffer with bytes- Returns:
- String with hexadecimal data
-
dump
public static java.lang.String dump(byte[] data, int offset, int length, int widths, int indent)
Dump buffer in hexadecimal format with offset and character codes- Parameters:
data
- Byte bufferoffset
- Offset into byte bufferlength
- Length of data to be dumpedwidths
- Number of bytes per lineindent
- Number of blanks to indent each line- Returns:
- String containing the dump
-
dump
public static java.lang.String dump(byte[] data, int offset, int length, int widths)
Dump buffer in hexadecimal format with offset and character codes- Parameters:
data
- Byte bufferoffset
- Offset into byte bufferlength
- Length of data to be dumpedwidths
- Number of bytes per line- Returns:
- String containing the dump
-
dump
public static java.lang.String dump(byte[] data, int offset, int length)
Dump buffer in hexadecimal format with offset and character codes. Output 16 bytes per line- Parameters:
data
- Byte bufferoffset
- Offset into byte bufferlength
- Length of data to be dumped- Returns:
- String containing the dump
-
dump
public static java.lang.String dump(byte[] data)
Dump buffer in hexadecimal format with offset and character codes- Parameters:
data
- Byte buffer- Returns:
- String containing the dump
-
parseHexString
public static byte[] parseHexString(java.lang.String str)
Parse string of hexadecimal characters into byte array- Parameters:
str
- String to parse- Returns:
- byte array containing the string
-
-