st.ata.util
Class X

java.lang.Object
  extended byst.ata.util.X

public final class X
extends java.lang.Object

A collection of useful static methods.


Field Summary
static int DEBUG
           
 
Constructor Summary
X()
           
 
Method Summary
static void check(boolean b)
          Throws a runtime exception if b is not true.
static void check(boolean b, java.lang.String m)
          Throws a runtime exception if b is not true.
static void checkargs(boolean b)
          Throws an illegal argument exception if b is not true.
static void checkstate(boolean b)
          Throws an illegal state exception if b is not true.
static int decodeInt(byte[] buf, int offset)
           
static long decodeLong(byte[] buf, int offset)
           
static int decodeShort(byte[] buf, int offset)
           
static java.util.ArrayList dupElim(java.util.ArrayList al, java.util.Comparator cm)
           
static void encodeInt(byte[] buf, int offset, int val)
           
static void encodeLong(byte[] buf, int offset, long val)
           
static void encodeShort(byte[] buf, int offset, int val)
           
static void fail(java.lang.String m)
          Throws a runtime exception with message m.
static java.lang.String getFullDescription(java.lang.Throwable t)
          Returns a full description of a Throwable.
static void log(java.lang.String ctxt, java.util.logging.Level level, java.lang.String msg)
           
static void log(java.lang.String ctxt, java.util.logging.Level level, java.lang.String msg, java.lang.Throwable t)
           
static void noimpl()
           
static void popTrace(java.lang.Throwable t, int n)
          Removes the top n stack-trace elements from t.
static java.lang.String printable(byte[] data)
          returns the printable representation of data after escaping non-printable characters in C style.
static java.lang.String printable(byte[] data, int start, int end)
          returns the printable representation of data from start (inclusive) to end (exclusive).
static void printArgs(java.lang.String programName, java.lang.String[] args)
          print out the programName and arguments used
static void testFailure(java.lang.String systemProperty)
          Throws a runtime exception with message systemProperty.
static java.lang.RuntimeException toRTE(java.lang.Exception e)
          Returns an UndeclaredThrowableException wrapping e.
static void ut(boolean b)
          Same as ut(b, "").
static void ut(boolean b, java.lang.String m)
          Test condition during unit testing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final int DEBUG
See Also:
Constant Field Values
Constructor Detail

X

public X()
Method Detail

fail

public static void fail(java.lang.String m)
Throws a runtime exception with message m.


testFailure

public static void testFailure(java.lang.String systemProperty)
Throws a runtime exception with message systemProperty.

Parameters:
systemProperty - a String value which specifies a boolean system property, which if true will cause an exception to be thrown.

check

public static void check(boolean b)
Throws a runtime exception if b is not true.


check

public static void check(boolean b,
                         java.lang.String m)
Throws a runtime exception if b is not true.


checkargs

public static void checkargs(boolean b)
Throws an illegal argument exception if b is not true.


checkstate

public static void checkstate(boolean b)
Throws an illegal state exception if b is not true.


toRTE

public static java.lang.RuntimeException toRTE(java.lang.Exception e)
Returns an UndeclaredThrowableException wrapping e.


ut

public static void ut(boolean b)
Same as ut(b, "").


ut

public static void ut(boolean b,
                      java.lang.String m)
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.


printArgs

public static void printArgs(java.lang.String programName,
                             java.lang.String[] args)
print out the programName and arguments used


noimpl

public static void noimpl()

getFullDescription

public static java.lang.String getFullDescription(java.lang.Throwable t)
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.


popTrace

public static void popTrace(java.lang.Throwable t,
                            int n)
Removes the top n stack-trace elements from t. This is useful inside methods like fail(java.lang.String) to help debuggers more quickly identify the location of a failure.


decodeInt

public static int decodeInt(byte[] buf,
                            int offset)

decodeShort

public static int decodeShort(byte[] buf,
                              int offset)

encodeShort

public static void encodeShort(byte[] buf,
                               int offset,
                               int val)

encodeInt

public static void encodeInt(byte[] buf,
                             int offset,
                             int val)

decodeLong

public static long decodeLong(byte[] buf,
                              int offset)

encodeLong

public static void encodeLong(byte[] buf,
                              int offset,
                              long val)

printable

public static java.lang.String printable(byte[] data)
returns the printable representation of data after escaping non-printable characters in C style.


printable

public static java.lang.String printable(byte[] data,
                                         int start,
                                         int end)
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.


log

public static void log(java.lang.String ctxt,
                       java.util.logging.Level level,
                       java.lang.String msg,
                       java.lang.Throwable t)

log

public static void log(java.lang.String ctxt,
                       java.util.logging.Level level,
                       java.lang.String msg)

dupElim

public static java.util.ArrayList dupElim(java.util.ArrayList al,
                                          java.util.Comparator cm)


Copyright © 2003-2004 Internet Archive. All Rights Reserved.