public final class Util extends Object
Modifier and Type | Method and Description |
---|---|
static String |
bug(Throwable throwable)
Returns an information string for an unexpected exception.
|
static String |
className(Class<?> clazz)
Returns the name of the specified class, excluding its path.
|
static String |
className(Object object)
Returns the class name of the specified object, excluding its path.
|
static void |
debug(Object string,
Object... ext)
Prints a string to standard error if the
Prop.debug flag is set. |
static void |
debug(Throwable throwable)
Prints the exception stack trace if the
Prop.debug flag is set. |
static void |
err(String string,
Object... ext)
Prints a string to standard error.
|
static void |
errln(Object object,
Object... ext)
Prints a string to standard error, followed by a newline.
|
static String |
error(Process process,
int timeout)
Returns the error message of a process.
|
static byte[] |
inf(Object string,
Object... ext)
Returns a token and replaces all % characters by the specified extensions
(see
TokenBuilder.addExt(java.lang.Object, java.lang.Object...) for details). |
static String |
info(Object string,
Object... ext)
Returns a string and replaces all % characters by the specified extensions
(see
TokenBuilder.addExt(java.lang.Object, java.lang.Object...) for details). |
static String |
input()
Returns a single line from standard input.
|
static String |
message(Throwable throwable)
Returns a more user-friendly error message for the specified exception.
|
static RuntimeException |
notExpected()
Throws a runtime exception for an unexpected exception.
|
static RuntimeException |
notExpected(Object message,
Object... ext)
Throws a runtime exception for an unexpected exception.
|
static void |
out(Object string,
Object... ext)
Prints a string to standard output.
|
static void |
outln()
Prints a newline to standard output.
|
static void |
outln(Object string,
Object... ext)
Prints a string to standard output, followed by a newline.
|
static String |
password()
Returns a password from standard input.
|
static Throwable |
rootException(Throwable throwable)
Returns the root query exception.
|
static void |
stack(int depth)
Prints the current stack trace to System.err.
|
static void |
stack(String message)
Prints the current stack trace to System.err.
|
static void |
stack(Throwable throwable)
Prints the stack of the specified error to standard error.
|
static Process |
start(Class<?> clazz,
String... args)
Starts the specified class in a separate process.
|
public static String bug(Throwable throwable)
throwable
- exceptionpublic static RuntimeException notExpected()
public static RuntimeException notExpected(Object message, Object... ext)
message
- messageext
- optional extensionpublic static String className(Object object)
object
- objectpublic static String className(Class<?> clazz)
clazz
- classpublic static String input()
public static String password()
public static void outln()
public static void outln(Object string, Object... ext)
string
- output stringext
- text optional extensionspublic static void out(Object string, Object... ext)
string
- output stringext
- text optional extensionspublic static Throwable rootException(Throwable throwable)
throwable
- throwablepublic static void errln(Object object, Object... ext)
object
- error objectext
- text optional extensionspublic static void err(String string, Object... ext)
string
- debug stringext
- text optional extensionspublic static String message(Throwable throwable)
throwable
- throwable referencepublic static void debug(Throwable throwable)
Prop.debug
flag is set.throwable
- exceptionpublic static void debug(Object string, Object... ext)
Prop.debug
flag is set.string
- debug stringext
- text optional extensionspublic static String info(Object string, Object... ext)
TokenBuilder.addExt(java.lang.Object, java.lang.Object...)
for details).string
- string to be extendedext
- text text extensionspublic static byte[] inf(Object string, Object... ext)
TokenBuilder.addExt(java.lang.Object, java.lang.Object...)
for details).string
- string to be extendedext
- text text extensionspublic static void stack(String message)
message
- error messagepublic static void stack(int depth)
depth
- number of steps to printpublic static void stack(Throwable throwable)
throwable
- error/exception instancepublic static Process start(Class<?> clazz, String... args)
clazz
- class to startargs
- command-line argumentsProcess
instance representing the started processCopyright © 2005–2023 BaseX Team. All rights reserved.