public class StringUtil extends Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendFixedSize(StringBuilder s,
long value,
int fixedSize)
Convert the long to a string and append spaces up to the given fixed size.
|
static StringBuilder |
appendPadding(char padding,
int nb,
String s,
StringBuilder to)
Append padding character to a StringBuilder.
|
static int |
decodeHexa(char c)
Return the integer value of the given hexadecimal digit, or -1 if it is not an hexadecimal digit.
|
static byte[] |
decodeHexa(String s)
Decode a string containing hexadecimal digits into an array of bytes.
|
static void |
decodeHexa(String s,
byte[] data)
Decode a string containing hexadecimal digits into the given array of bytes.
|
static byte |
decodeHexaByte(String hexa)
Decode the given hexadecimal string into a byte (the string must contain 1 or 2 hexa digits).
|
static long |
decodeHexaLong(String hexa)
Decode the given string containing hexadecimal digits into a long value.
|
static String |
encodeHexa(byte b)
Encode the given byte into hexadecimal.
|
static String |
encodeHexa(byte[] data)
Encode the given bytes into hexadecimal.
|
static String |
encodeHexa(byte[] data,
int off,
int len)
Encode the given bytes into hexadecimal.
|
static char |
encodeHexaDigit(int value)
Encode a single hexadecimal digit (given value must be between 0 and 15).
|
static String |
encodeHexaPadding(long value)
Encode a long value into hexadecimal, padding with zeros to create a string of 16 characters.
|
static boolean |
isHexa(char c) |
static void |
padding(StringBuilder s,
int length)
Add spaces until the StringBuilder has the given length.
|
static long |
parseSize(String s)
Parse the given string containing a size with a unit (B for bytes, K for KB...).
|
static String |
possibleValues(Class<? extends Enum<?>> e)
Create a string containing all enumeration values separated by a comma, for printing or debugging purpose.
|
static String |
size(BigInteger s)
Create a string for the given size, expressed in bytes or KB or MB or GB or TB, with 2 decimals.
|
static String |
size(long size)
Create a string for the given size, expressed in bytes or KB or MB or GB or TB, with 2 decimals.
|
static String |
size(Number size)
Create a string for the given size, expressed in bytes or KB or MB or GB or TB, with 2 decimals.
|
public static StringBuilder appendPadding(char padding, int nb, String s, StringBuilder to)
public static void appendFixedSize(StringBuilder s, long value, int fixedSize)
public static void padding(StringBuilder s, int length)
public static String encodeHexa(byte[] data)
public static String encodeHexa(byte[] data, int off, int len)
public static String encodeHexa(byte b)
public static char encodeHexaDigit(int value)
public static String encodeHexaPadding(long value)
public static byte[] decodeHexa(String s)
public static void decodeHexa(String s, byte[] data)
public static int decodeHexa(char c)
public static byte decodeHexaByte(String hexa)
public static long decodeHexaLong(String hexa)
public static boolean isHexa(char c)
public static String possibleValues(Class<? extends Enum<?>> e)
public static String size(long size)
public static String size(Number size)
public static String size(BigInteger s)
public static long parseSize(String s) throws NumberFormatException
NumberFormatExceptionCopyright © 2017. All rights reserved.