public final class Utils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.lang.String> |
asList(java.lang.String text)
Splits a text in several lines.
|
static java.lang.String |
run(java.io.File wd,
java.lang.String cmd,
java.lang.String... args)
Runs a command in the
wd directory and returns its output. |
static boolean |
safeRegexMatch(java.lang.String pattern,
java.lang.String value)
Exception safe regex match (to protect against malformed expressions)
|
static java.lang.String |
toHexString(byte[] bytes)
Writes some bytes in Hexadecimal format
|
static java.lang.String |
toHexString(byte[] bytes,
int start,
int len)
Writes some bytes in Hexadecimal format
|
static java.lang.String |
toString(byte[] bytes)
UTF-8 bytes as String
|
public static boolean safeRegexMatch(java.lang.String pattern,
java.lang.String value)
public static java.util.List<java.lang.String> asList(java.lang.String text)
text - Text to splitpublic static java.lang.String run(java.io.File wd,
java.lang.String cmd,
java.lang.String... args)
wd directory and returns its output. In case of error (exit
code different than 0), an exception is thrown.wd - Directory where to execute the commandcmd - Command to executeargs - Command parameterspublic static java.lang.String toHexString(byte[] bytes)
bytes - Bytes to formatpublic static java.lang.String toHexString(byte[] bytes,
int start,
int len)
bytes - Bytes to formatstart - Start position for the conversionlen - Number of bytes to convertpublic static java.lang.String toString(byte[] bytes)