|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
This class defines severals utilities methods used in source code
| Field Summary | |
private static boolean |
caseInsensitiveFS
|
private static String |
CURRENT
|
static int |
DBG_LEVEL_HIGH
|
static int |
DBG_LEVEL_LOW
|
static int |
DBG_LEVEL_NO
|
private static boolean |
DEBUG_ENABLED
|
private static int |
debugLevel
|
private static String |
FILE_SEP
|
private static String |
UP
|
| Constructor Summary | |
Utils()
|
|
| Method Summary | |
static void |
assertTrue(boolean b)
Check if an assertion is valid |
static void |
assertTrue(boolean b,
String message)
Check if an assertion is valid |
static Object[] |
combineArrays(Object[] x,
Object[] y)
Combines two reference arrays of into one; the result has the same dynamic type as the first argument. |
static String |
escapeString(String val)
Returns a String formed by translating Unicode characters for the standard Java escape sequences into the corresponding escape sequences from JLS2, 3.10.6. |
static String |
escapeString(String val,
boolean escapeApostrophes)
Returns a String formed by translating Unicode characters for the standard Java escape sequences into the corresponding escape sequences from JLS2, 3.10.6. |
static void |
fail()
Throws an error. |
static void |
fail(String message)
Throws an error. |
static String |
getFilePath(File f)
Returns the canonical path of the given File, or the absolute path if an exception is thrown by the underlying file system when constructing the canonical path. |
static boolean |
hasFlag(long modifiers,
long flags)
Returns true if any of the bits set in flags are
are also enabled in modifiers. |
static boolean |
hasOtherFlags(long modifiers,
long flags)
Returns true if modifiers has any bits set other
than those in flags. |
static List |
parsePathParts(File path)
Returns a list of Strings representing the parts of the given path, assembled by repeatedly invoking getName()
on getParentFile() of the given path
until no parent path parts remain. |
static String |
relativePathTo(File file)
Returns a String representing the relative path from the current user directory, user.dir, to the given
file. |
static String[] |
splitQualifiedName(String name)
Splits a string like: "java/lang/System/out" into two strings: "java/lang/System" and "out" |
static String[] |
splitQualifiedName(String name,
char separator)
Splits a string like: "java/lang/System/out" into two strings: "java/lang/System" and "out" |
static long |
stripJavaModifiers(long modifiers)
Returns the modifiers with the Java bit masks stripped. |
static long |
stripNonJavaModifiers(long modifiers)
Returns the modifiers with the non-Java bit masks stripped. |
static long |
stripPrivateModifier(long modifiers)
Returns the modifiers with the Private modifier stripped. |
static String |
unescapeString(String val)
Returns a String formed by translating Java escape sequences in the given String into single Unicode characters. |
static Object[] |
vectorToArray(Vector vect,
Class type)
Creates a typed array from a vector. |
static int[] |
vectorToIntArray(Vector vect)
Creates a int array from a vector. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DBG_LEVEL_NO
public static final int DBG_LEVEL_LOW
public static final int DBG_LEVEL_HIGH
private static String CURRENT
private static String UP
private static String FILE_SEP
private static boolean caseInsensitiveFS
private static final boolean DEBUG_ENABLED
private static int debugLevel
| Constructor Detail |
public Utils()
| Method Detail |
public static final void assertTrue(boolean b,
String message)
RuntimeException - the entire token referencepublic static final void fail(String message)
RuntimeException - the entire token referencepublic static final void assertTrue(boolean b)
RuntimeException - the entire token referencepublic static final void fail()
RuntimeException - the entire token reference
public static boolean hasFlag(long modifiers,
long flags)
flags are
are also enabled in modifiers. This method is
usually used to check for a single flag.
modifiers - the modifiers bit maskflags - the flags to be checked
public static boolean hasOtherFlags(long modifiers,
long flags)
modifiers has any bits set other
than those in flags.
modifiers - the modifiers bit maskflags - the flags that are supposed to be in modifiers
public static long stripNonJavaModifiers(long modifiers)
modifiers with the non-Java bit masks stripped.
modifiers - the modifiers bit mask
public static long stripJavaModifiers(long modifiers)
modifiers with the Java bit masks stripped.
modifiers - the modifiers bit mask
public static long stripPrivateModifier(long modifiers)
modifiers with the Private modifier stripped.
modifiers - the modifiers bit mask
public static Object[] vectorToArray(Vector vect,
Class type)
vect - the vector containing the elementstype - the type of the elementspublic static int[] vectorToIntArray(Vector vect)
vect - the vector containing the elements
public static Object[] combineArrays(Object[] x,
Object[] y)
public static String[] splitQualifiedName(String name,
char separator)
public static String[] splitQualifiedName(String name)
public static final String unescapeString(String val)
escapeString(String)public static final String escapeString(String val)
escapeString(String,boolean),
unescapeString(String)
public static final String escapeString(String val,
boolean escapeApostrophes)
unescapeString(String)public static final String relativePathTo(File file)
user.dir, to the given
file.
requires file != null;
public static final List parsePathParts(File path)
getName()
on getParentFile() of the given path
until no parent path parts remain.
public static String getFilePath(File f)
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||