de.grogra.util
Class Utils

java.lang.Object
  extended by de.grogra.util.Utils

public final class Utils
extends java.lang.Object


Field Summary
static boolean[] BOOLEAN_0
           
static byte[] BYTE_0
           
static char[] CHAR_0
           
static java.io.PrintWriter debug
           
static int DEBUG
           
static double[] DOUBLE_0
           
static float[] FLOAT_0
           
static I18NBundle I18N
           
static int[] INT_0
           
static long[] LONG_0
           
static java.lang.Object[] OBJECT_0
           
static short[] SHORT_0
           
static java.lang.String[] STRING_0
           
 
Method Summary
static boolean contentEquals(java.lang.CharSequence a, java.lang.CharSequence b)
           
static int decodeBase64(java.lang.CharSequence in, int offset, int len, byte[] out)
           
static java.lang.Object decodeBase64(java.lang.CharSequence in, int offset, int len, TypeLoader loader)
           
static void dumpArray(java.lang.Object array)
           
static void dumpTree(javax.swing.tree.TreeModel tree)
           
static void encodeBase64(byte[] buf, int off, int len, java.lang.StringBuffer out)
           
static void encodeBase64(java.lang.Object object, java.lang.StringBuffer out)
           
static boolean equal(java.lang.Object o1, java.lang.Object o2)
           
static java.lang.String escape(java.lang.CharSequence s, java.lang.String special)
           
static void escapeForXML(java.lang.StringBuffer b, int start)
           
static void escapeForXML(java.lang.StringBuffer b, int start, int end)
           
static java.lang.String eval(java.lang.String s, Map vars)
           
static java.lang.Object evaluate(java.lang.String clsAndMember, java.lang.Object[] args, java.lang.ClassLoader loader)
           
static int executeForcedlyAndUninterruptibly(Lockable resource, LockProtectedRunnable task, boolean write)
           
static int executeForcedlyAndUninterruptibly(Lockable resource, LockProtectedRunnable task, Lock retained)
           
static java.net.URL fileToURL(java.io.File file)
           
static java.lang.String firstToUpperCase(java.lang.String s)
           
static void flushHandlers(java.util.logging.Logger logger)
           
static void formatDateAndName(java.util.logging.LogRecord log, java.lang.StringBuffer buffer)
           
static int fromHexDigit(int c)
           
static java.lang.Object get(I18NBundle bundle, java.lang.String key, java.lang.String type, java.lang.Object defaultDescription)
           
static java.lang.Object get(Map a, java.lang.Object key, java.lang.Object defaultValue)
           
static java.awt.Color getApproximateColor(int rgb)
           
static boolean getBoolean(Map a, java.lang.Object key)
           
static boolean getBoolean(Map a, java.lang.Object key, boolean defaultValue)
           
static byte getByte(Map a, java.lang.Object key)
           
static byte getByte(Map a, java.lang.Object key, byte defaultValue)
           
static char getChar(Map a, java.lang.Object key)
           
static char getChar(Map a, java.lang.Object key, char defaultValue)
           
static java.lang.String getDisplayLoggerName(java.lang.String logger)
           
static double getDouble(Map a, java.lang.Object key)
           
static double getDouble(Map a, java.lang.Object key, double defaultValue)
           
static float getFloat(Map a, java.lang.Object key)
           
static float getFloat(Map a, java.lang.Object key, float defaultValue)
           
static int getInt(Map a, java.lang.Object key)
           
static int getInt(Map a, java.lang.Object key, int defaultValue)
           
static long getLong(Map a, java.lang.Object key)
           
static long getLong(Map a, java.lang.Object key, long defaultValue)
           
static java.lang.Throwable getMainException(java.lang.Throwable t)
           
static java.lang.Object getObject(Map a, java.lang.Object key)
           
static java.lang.Object getObject(Map a, java.lang.Object key, java.lang.Object defaultValue)
           
static short getShort(Map a, java.lang.Object key)
           
static short getShort(Map a, java.lang.Object key, short defaultValue)
           
static java.lang.String getStackTrace(java.lang.Throwable t)
           
static java.io.InputStream getStreamResource(java.lang.String url)
           
static int getStringHashCode(java.lang.CharSequence c)
           
static int getStringHashCode(java.lang.CharSequence c, int begin, int end)
           
static java.net.URL getURLResource(java.lang.String url)
           
static java.lang.Throwable getUserException(java.lang.Throwable t)
           
static int hashCode(java.lang.Object[] array)
           
static boolean hasNanoTimeMethod()
           
static int indexOfOne(int i)
           
static java.lang.Throwable initCauses(java.lang.Throwable t)
           
static java.lang.Object invoke(java.lang.String clsAndMethod, java.lang.Object[] args, java.lang.ClassLoader loader)
           
static java.lang.Object invokeStatic(java.lang.Class cls, java.lang.String method, java.lang.Object[] args)
           
static java.lang.Object invokeStatic(java.lang.String cls, java.lang.String method, java.lang.Object[] args, java.lang.ClassLoader loader)
           
static java.lang.Object invokeVirtual(java.lang.Object instance, java.lang.String method, java.lang.Object[] args)
           
static boolean isContained(java.lang.Object value, java.lang.Object[] array)
           
static boolean isStringDescription(java.lang.String type)
           
static boolean isURL(java.lang.String systemId)
           
static long nanoTime()
           
static java.lang.Object newInstance(java.lang.Class cls, java.lang.Object[] args)
           
static java.lang.Object newInstance(java.lang.String cls, java.lang.Object[] args, java.lang.ClassLoader loader)
           
static org.xml.sax.SAXException newSAXException(java.lang.Exception cause)
           
static java.awt.Color parseColor(java.lang.String s)
           
static java.awt.Dimension parseDimension(java.lang.String s)
           
static int parseFloatArray(java.lang.String s, float[] a, java.lang.String delim)
           
static java.awt.Point parsePoint(java.lang.String s)
           
static java.awt.Rectangle parseRectangle(java.lang.String s)
           
static void printTime(java.lang.String msg)
           
static java.lang.String quote(java.lang.CharSequence s)
           
static void quote(java.lang.CharSequence s, java.lang.StringBuffer out)
           
static void read(java.io.Reader in, java.lang.StringBuffer out)
           
static void readFully(java.io.InputStream in, byte[] buf)
           
static void readFully(java.io.InputStream in, byte[] buf, int off, int len)
           
static java.io.File relativize(java.io.File base, java.io.File f)
           
static void resetTime()
           
static java.io.File resolve(java.io.File base, java.io.File f)
           
static void rethrow(java.lang.Throwable t)
           
static void setDisplayLoggerName(java.lang.String logger, java.lang.String name)
           
static char toHexDigit(int digit, boolean upperCase)
           
static java.lang.String unquote(java.lang.CharSequence s)
           
static java.lang.String unquote(java.lang.CharSequence s, int start, int end, int[] endOut)
           
static java.lang.Throwable unwrap(java.lang.Throwable t)
           
static java.lang.Throwable unwrapFully(java.lang.Throwable t)
           
static java.io.File urlToFile(java.net.URL url)
           
static void watchShutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN_0

public static final boolean[] BOOLEAN_0

BYTE_0

public static final byte[] BYTE_0

CHAR_0

public static final char[] CHAR_0

debug

public static java.io.PrintWriter debug

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

DOUBLE_0

public static final double[] DOUBLE_0

FLOAT_0

public static final float[] FLOAT_0

I18N

public static final I18NBundle I18N

INT_0

public static final int[] INT_0

LONG_0

public static final long[] LONG_0

OBJECT_0

public static final java.lang.Object[] OBJECT_0

SHORT_0

public static final short[] SHORT_0

STRING_0

public static final java.lang.String[] STRING_0
Method Detail

contentEquals

public static boolean contentEquals(java.lang.CharSequence a,
                                    java.lang.CharSequence b)

decodeBase64

public static int decodeBase64(java.lang.CharSequence in,
                               int offset,
                               int len,
                               byte[] out)
                        throws java.io.IOException
Throws:
java.io.IOException

decodeBase64

public static java.lang.Object decodeBase64(java.lang.CharSequence in,
                                            int offset,
                                            int len,
                                            TypeLoader loader)
                                     throws java.io.IOException,
                                            java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

dumpArray

public static void dumpArray(java.lang.Object array)

dumpTree

public static void dumpTree(javax.swing.tree.TreeModel tree)

encodeBase64

public static void encodeBase64(byte[] buf,
                                int off,
                                int len,
                                java.lang.StringBuffer out)

encodeBase64

public static void encodeBase64(java.lang.Object object,
                                java.lang.StringBuffer out)
                         throws java.io.IOException
Throws:
java.io.IOException

equal

public static boolean equal(java.lang.Object o1,
                            java.lang.Object o2)

escape

public static java.lang.String escape(java.lang.CharSequence s,
                                      java.lang.String special)

escapeForXML

public static void escapeForXML(java.lang.StringBuffer b,
                                int start)

escapeForXML

public static void escapeForXML(java.lang.StringBuffer b,
                                int start,
                                int end)

eval

public static final java.lang.String eval(java.lang.String s,
                                          Map vars)

evaluate

public static java.lang.Object evaluate(java.lang.String clsAndMember,
                                        java.lang.Object[] args,
                                        java.lang.ClassLoader loader)
                                 throws java.lang.ClassNotFoundException,
                                        java.lang.NoSuchMethodException,
                                        java.lang.NoSuchFieldException,
                                        java.lang.InstantiationException,
                                        java.lang.IllegalAccessException,
                                        java.lang.reflect.InvocationTargetException
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.NoSuchFieldException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

executeForcedlyAndUninterruptibly

public static int executeForcedlyAndUninterruptibly(Lockable resource,
                                                    LockProtectedRunnable task,
                                                    boolean write)

executeForcedlyAndUninterruptibly

public static int executeForcedlyAndUninterruptibly(Lockable resource,
                                                    LockProtectedRunnable task,
                                                    Lock retained)

fileToURL

public static java.net.URL fileToURL(java.io.File file)

firstToUpperCase

public static java.lang.String firstToUpperCase(java.lang.String s)

flushHandlers

public static void flushHandlers(java.util.logging.Logger logger)

formatDateAndName

public static void formatDateAndName(java.util.logging.LogRecord log,
                                     java.lang.StringBuffer buffer)

fromHexDigit

public static int fromHexDigit(int c)

get

public static java.lang.Object get(I18NBundle bundle,
                                   java.lang.String key,
                                   java.lang.String type,
                                   java.lang.Object defaultDescription)

get

public static java.lang.Object get(Map a,
                                   java.lang.Object key,
                                   java.lang.Object defaultValue)

getApproximateColor

public static java.awt.Color getApproximateColor(int rgb)

getBoolean

public static boolean getBoolean(Map a,
                                 java.lang.Object key)

getBoolean

public static boolean getBoolean(Map a,
                                 java.lang.Object key,
                                 boolean defaultValue)

getByte

public static byte getByte(Map a,
                           java.lang.Object key)

getByte

public static byte getByte(Map a,
                           java.lang.Object key,
                           byte defaultValue)

getChar

public static char getChar(Map a,
                           java.lang.Object key)

getChar

public static char getChar(Map a,
                           java.lang.Object key,
                           char defaultValue)

getDisplayLoggerName

public static java.lang.String getDisplayLoggerName(java.lang.String logger)

getDouble

public static double getDouble(Map a,
                               java.lang.Object key)

getDouble

public static double getDouble(Map a,
                               java.lang.Object key,
                               double defaultValue)

getFloat

public static float getFloat(Map a,
                             java.lang.Object key)

getFloat

public static float getFloat(Map a,
                             java.lang.Object key,
                             float defaultValue)

getInt

public static int getInt(Map a,
                         java.lang.Object key)

getInt

public static int getInt(Map a,
                         java.lang.Object key,
                         int defaultValue)

getLong

public static long getLong(Map a,
                           java.lang.Object key)

getLong

public static long getLong(Map a,
                           java.lang.Object key,
                           long defaultValue)

getMainException

public static java.lang.Throwable getMainException(java.lang.Throwable t)

getObject

public static java.lang.Object getObject(Map a,
                                         java.lang.Object key)

getObject

public static java.lang.Object getObject(Map a,
                                         java.lang.Object key,
                                         java.lang.Object defaultValue)

getShort

public static short getShort(Map a,
                             java.lang.Object key)

getShort

public static short getShort(Map a,
                             java.lang.Object key,
                             short defaultValue)

getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable t)

getStreamResource

public static java.io.InputStream getStreamResource(java.lang.String url)

getStringHashCode

public static int getStringHashCode(java.lang.CharSequence c)

getStringHashCode

public static int getStringHashCode(java.lang.CharSequence c,
                                    int begin,
                                    int end)

getURLResource

public static java.net.URL getURLResource(java.lang.String url)

getUserException

public static java.lang.Throwable getUserException(java.lang.Throwable t)

hashCode

public static int hashCode(java.lang.Object[] array)

hasNanoTimeMethod

public static boolean hasNanoTimeMethod()

indexOfOne

public static int indexOfOne(int i)

initCauses

public static java.lang.Throwable initCauses(java.lang.Throwable t)

invoke

public static java.lang.Object invoke(java.lang.String clsAndMethod,
                                      java.lang.Object[] args,
                                      java.lang.ClassLoader loader)
                               throws java.lang.ClassNotFoundException,
                                      java.lang.NoSuchMethodException,
                                      java.lang.InstantiationException,
                                      java.lang.IllegalAccessException,
                                      java.lang.reflect.InvocationTargetException
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

invokeStatic

public static java.lang.Object invokeStatic(java.lang.Class cls,
                                            java.lang.String method,
                                            java.lang.Object[] args)
                                     throws java.lang.NoSuchMethodException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
Throws:
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

invokeStatic

public static java.lang.Object invokeStatic(java.lang.String cls,
                                            java.lang.String method,
                                            java.lang.Object[] args,
                                            java.lang.ClassLoader loader)
                                     throws java.lang.ClassNotFoundException,
                                            java.lang.NoSuchMethodException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

invokeVirtual

public static java.lang.Object invokeVirtual(java.lang.Object instance,
                                             java.lang.String method,
                                             java.lang.Object[] args)
                                      throws java.lang.NoSuchMethodException,
                                             java.lang.IllegalAccessException,
                                             java.lang.reflect.InvocationTargetException
Throws:
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

isContained

public static boolean isContained(java.lang.Object value,
                                  java.lang.Object[] array)

isStringDescription

public static boolean isStringDescription(java.lang.String type)

isURL

public static boolean isURL(java.lang.String systemId)

nanoTime

public static long nanoTime()

newInstance

public static java.lang.Object newInstance(java.lang.Class cls,
                                           java.lang.Object[] args)
                                    throws java.lang.NoSuchMethodException,
                                           java.lang.InstantiationException,
                                           java.lang.IllegalAccessException,
                                           java.lang.reflect.InvocationTargetException
Throws:
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

newInstance

public static java.lang.Object newInstance(java.lang.String cls,
                                           java.lang.Object[] args,
                                           java.lang.ClassLoader loader)
                                    throws java.lang.ClassNotFoundException,
                                           java.lang.NoSuchMethodException,
                                           java.lang.InstantiationException,
                                           java.lang.IllegalAccessException,
                                           java.lang.reflect.InvocationTargetException
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

newSAXException

public static org.xml.sax.SAXException newSAXException(java.lang.Exception cause)

parseColor

public static java.awt.Color parseColor(java.lang.String s)

parseDimension

public static java.awt.Dimension parseDimension(java.lang.String s)

parseFloatArray

public static int parseFloatArray(java.lang.String s,
                                  float[] a,
                                  java.lang.String delim)

parsePoint

public static java.awt.Point parsePoint(java.lang.String s)

parseRectangle

public static java.awt.Rectangle parseRectangle(java.lang.String s)

printTime

public static void printTime(java.lang.String msg)

quote

public static java.lang.String quote(java.lang.CharSequence s)

quote

public static void quote(java.lang.CharSequence s,
                         java.lang.StringBuffer out)

read

public static void read(java.io.Reader in,
                        java.lang.StringBuffer out)
                 throws java.io.IOException
Throws:
java.io.IOException

readFully

public static void readFully(java.io.InputStream in,
                             byte[] buf)
                      throws java.io.IOException
Throws:
java.io.IOException

readFully

public static void readFully(java.io.InputStream in,
                             byte[] buf,
                             int off,
                             int len)
                      throws java.io.IOException
Throws:
java.io.IOException

relativize

public static java.io.File relativize(java.io.File base,
                                      java.io.File f)

resetTime

public static void resetTime()

resolve

public static java.io.File resolve(java.io.File base,
                                   java.io.File f)

rethrow

public static void rethrow(java.lang.Throwable t)

setDisplayLoggerName

public static void setDisplayLoggerName(java.lang.String logger,
                                        java.lang.String name)

toHexDigit

public static char toHexDigit(int digit,
                              boolean upperCase)

unquote

public static java.lang.String unquote(java.lang.CharSequence s)

unquote

public static java.lang.String unquote(java.lang.CharSequence s,
                                       int start,
                                       int end,
                                       int[] endOut)

unwrap

public static java.lang.Throwable unwrap(java.lang.Throwable t)

unwrapFully

public static java.lang.Throwable unwrapFully(java.lang.Throwable t)

urlToFile

public static java.io.File urlToFile(java.net.URL url)

watchShutdown

public static void watchShutdown()