| java.lang.Object st.ata.util.X
X | final public class X (Code) | | A collection of useful static methods.
|
Field Summary | |
final public static int | DEBUG |
Method Summary | |
public static void | check(boolean b) Throws a runtime exception if b is not true. | public static void | check(boolean b, String m) Throws a runtime exception if b is not true. | public static void | checkargs(boolean b) Throws an illegal argument exception if b is not true. | public static void | checkstate(boolean b) Throws an illegal state exception if b is not true. | public static int | decodeInt(byte[] buf, int offset) | public static long | decodeLong(byte[] buf, int offset) | public static int | decodeShort(byte[] buf, int offset) | public static ArrayList | dupElim(ArrayList al, Comparator cm) | public static void | encodeInt(byte[] buf, int offset, int val) | public static void | encodeLong(byte[] buf, int offset, long val) | public static void | encodeShort(byte[] buf, int offset, int val) | public static void | fail(String m) Throws a runtime exception with message m . | public static String | getFullDescription(Throwable t) Returns a full description of a
Throwable . | public static void | log(String ctxt, Level level, String msg, Throwable t) | public static void | log(String ctxt, Level level, String msg) | public static void | noimpl() | public static void | popTrace(Throwable t, int n) Removes the top n stack-trace elements from
t . | public static void | printArgs(String programName, String[] args) | public static String | printable(byte[] data) returns the printable representation of data
after escaping non-printable characters in C style. | public static String | printable(byte[] data, int start, int end) returns the printable representation of data
from start (inclusive) to end (exclusive). | public static void | testFailure(String systemProperty) Throws a runtime exception with message systemProperty . | public static RuntimeException | toRTE(Exception e) Returns an
UndeclaredThrowableException wrapping e . | public static void | ut(boolean b) Same as ut(b, ""). | public static void | ut(boolean b, String m) Test condition during unit testing. |
DEBUG | final public static int DEBUG(Code) | | |
check | public static void check(boolean b)(Code) | | Throws a runtime exception if b is not true.
|
check | public static void check(boolean b, String m)(Code) | | Throws a runtime exception if b is not true.
|
checkargs | public static void checkargs(boolean b)(Code) | | Throws an illegal argument exception if b is not true.
|
checkstate | public static void checkstate(boolean b)(Code) | | Throws an illegal state exception if b is not true.
|
decodeInt | public static int decodeInt(byte[] buf, int offset)(Code) | | |
decodeLong | public static long decodeLong(byte[] buf, int offset)(Code) | | |
decodeShort | public static int decodeShort(byte[] buf, int offset)(Code) | | |
encodeInt | public static void encodeInt(byte[] buf, int offset, int val)(Code) | | |
encodeLong | public static void encodeLong(byte[] buf, int offset, long val)(Code) | | |
encodeShort | public static void encodeShort(byte[] buf, int offset, int val)(Code) | | |
fail | public static void fail(String m)(Code) | | Throws a runtime exception with message m .
|
getFullDescription | public static String getFullDescription(Throwable t)(Code) | | Returns a full description of a
Throwable . This full
description includes a stack trace. This method will never
throw an error or exception: if something bad happens, it
simply returns null.
|
noimpl | public static void noimpl()(Code) | | |
popTrace | public static void popTrace(Throwable t, int n)(Code) | | Removes the top n stack-trace elements from
t . This is useful inside methods like
X.fail to help debuggers more quickly identify the location of
a failure.
|
printArgs | public static void printArgs(String programName, String[] args)(Code) | | print out the programName and arguments used
|
printable | public static String printable(byte[] data)(Code) | | returns the printable representation of data
after escaping non-printable characters in C style.
|
printable | public static String printable(byte[] data, int start, int end)(Code) | | returns the printable representation of data
from start (inclusive) to end (exclusive).
after escaping non-printable characters in C style.
data may not be null and
start must be smaller or equal to end
Both start and end are bounded by
0 and data.length bot inclusive.
|
testFailure | public static void testFailure(String systemProperty)(Code) | | Throws a runtime exception with message systemProperty .
Parameters: systemProperty - a String value which specifiesa boolean system property, which if true will causean exception to be thrown. |
ut | public static void ut(boolean b)(Code) | | Same as ut(b, "").
|
ut | public static void ut(boolean b, String m)(Code) | | Test condition during unit testing. If b is true, does
nothing. If b is not true, prints (to
System.out)
"Unit test failure: " + m and
a stack trace then returns.
|
|
|