|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javawebparts.core.JWPHelpers
This class contains miscellaneous methods that are used by classes in
multiple packages.
This class depends on the following extra packages, beyond the JDK,
to compile and run: None.
Constructor Summary | |
private |
JWPHelpers()
This is a utility class, so we want a private noarg constructor so instances cannot be created. |
Method Summary | |
static java.lang.String |
encodeEntities(java.lang.String str,
java.lang.String exclusions)
This method replaces any character in a given string that has a corresponding HTML entity with that entity. |
static java.lang.Object |
getFieldWithPrivilege(java.lang.reflect.Field fld,
java.lang.Object obj)
This method is used by the serializiableTest() method to get the needed priveleges on a given field of a given object needed to perform the serializable test. |
static int |
randomNumber(int low,
int high)
This method is used to generate a random number in a given range and the number should be more random than the standard Java random number generator and also should guarantee that a random number generated on two different machines at the exact same time will yield a different number. |
static java.lang.String[] |
readFromFile(java.lang.String pathToFile)
Read a file and return its contents as an array of Strings. |
static java.lang.String |
serializiableTest(java.lang.Object obj)
This method is used by the getContextSize() method to determine if a given object is serializable. |
static void |
writeToFile(java.lang.String pathToFile,
java.lang.String[] lines,
boolean append)
Write an array of lines out to file a file, overwriting the file if it already exists. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
private JWPHelpers()
Method Detail |
public static java.lang.String serializiableTest(java.lang.Object obj)
obj
- The object to test.
public static java.lang.Object getFieldWithPrivilege(java.lang.reflect.Field fld, java.lang.Object obj)
fld
- The field to get priveleges on.obj
- The object to test.
public static void writeToFile(java.lang.String pathToFile, java.lang.String[] lines, boolean append) throws java.io.IOException
pathToFile
- Path to file to write.lines
- Array of lines to be saved to the file.append
- True to append to an existing file, if it exists, or
false to overwrite an existing file, if it exists.
java.io.IOException
- If any problems are encountered.public static java.lang.String[] readFromFile(java.lang.String pathToFile) throws java.io.IOException
pathToFile
- Path to file to write.
java.io.IOException
- If any other problems are encountered.public static int randomNumber(int low, int high)
low
- Lowest numeber allowed.high
- Highest number allowed.
public static java.lang.String encodeEntities(java.lang.String str, java.lang.String exclusions)
str
- The string to insert entities into.exclusions
- Characters you DO NOT wanted entities inserted for.
Pass null for no exclusions.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |