|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.japano.util.Util
public class Util
Contains various static utility methods usefull for webapplications.
Nested Class Summary | |
---|---|
static class |
Util.TEST
Test methods for Util |
Field Summary | |
---|---|
static java.util.List |
ALLOWED_STRICT
|
Method Summary | |
---|---|
static java.util.Map |
asMap(java.lang.Object[] keyValue)
Returns an unmodifiable map containing the keys and values from the given Object array. |
static java.security.SecureRandom |
createSecureRandom()
Creates a new secure random number generator. |
static void |
deleteRecursively(java.lang.String dir)
Recursively deletes a directory and all sub directories and files. |
static java.lang.Object |
deserialized(java.lang.String path)
Deserializes an object from a file. |
static java.lang.String |
dumpAsHTML(java.lang.Object o)
|
static java.lang.String |
encode(byte[] data)
|
static java.lang.String |
getDate(long stamp)
Returns a textual representation of the given time stamp (Format: MM.dd.yyyy - HH:mm:ss.SSS). |
static org.apache.log4j.Logger |
getLogger()
Returns the utility class logger. |
static java.lang.String |
getSHADigest(java.lang.String input)
Returns the hex encoded SHA-digest for a given input. |
static java.lang.String |
htmlEncode(java.lang.String text,
boolean convertTags)
Converts illegal Characters to HTML entities. |
static boolean |
isAbsoluteURL(java.lang.String url)
|
static void |
main(java.lang.String[] args)
|
static void |
printThrowable(Buffer out,
java.lang.Throwable t)
|
static java.lang.String |
quoteEscape(java.lang.String s)
Makes the given String safe to be enclosed in quotes. |
static java.lang.String |
randomWord(int len)
Generates a secure random word with the given length. |
static java.lang.String |
randomWord(int len,
char[] alphabet)
Generates a secure random word with the given length. |
static java.util.Map |
readMap(java.io.InputStream is)
|
static java.util.Map |
readMap(java.lang.String path)
Reads the map from the a given path. |
static java.lang.String |
removeJavadocTags(java.lang.String text)
|
static java.lang.String |
replace(java.lang.String in,
java.lang.String what,
java.lang.String with)
|
static java.lang.String |
safeHTML(java.lang.String value,
java.util.List allowedTags)
Makes safe html out of a given html snippet. |
static void |
serialize(java.lang.String path,
java.lang.Object o)
Serializes the given object into a file. |
static void |
writeCollection(java.util.Collection c,
java.lang.String path,
java.lang.String comment)
Writes a collection to a text file. the objects in the collection are seperated by a line separator. |
static void |
writeMap(java.util.Map m,
java.lang.String path,
java.lang.String comment)
Writes a Map to a text file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.List ALLOWED_STRICT
Method Detail |
---|
public static java.lang.String htmlEncode(java.lang.String text, boolean convertTags)
text
- Text to encodeconvertTags
- if true
, HTML tags are readable as text ( "<b>"
becomes "<b>" ).
public static java.lang.String getSHADigest(java.lang.String input)
input
- Text input
public static java.lang.String randomWord(int len)
len
- Amount of random characters to generate
public static java.lang.String randomWord(int len, char[] alphabet)
len
- Amount of random characters to generatealphabet
- Alphabet to generate from.
public static void deleteRecursively(java.lang.String dir)
dir
- path of the directory to delete.public static org.apache.log4j.Logger getLogger()
public static java.lang.String getDate(long stamp)
public static java.lang.String safeHTML(java.lang.String value, java.util.List allowedTags)
allowedTags
- string list of allowed tags.value
- HTML snippet
public static java.lang.String dumpAsHTML(java.lang.Object o)
public static java.util.Map asMap(java.lang.Object[] keyValue) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the length of the given array is not an even number.public static java.security.SecureRandom createSecureRandom()
public static void printThrowable(Buffer out, java.lang.Throwable t)
public static boolean isAbsoluteURL(java.lang.String url)
public static java.lang.String replace(java.lang.String in, java.lang.String what, java.lang.String with)
public static void writeCollection(java.util.Collection c, java.lang.String path, java.lang.String comment)
'#'
.
public static void writeMap(java.util.Map m, java.lang.String path, java.lang.String comment)
'#'
.
public static java.util.Map readMap(java.lang.String path)
public static java.util.Map readMap(java.io.InputStream is)
public static java.lang.Object deserialized(java.lang.String path)
path
-
public static void serialize(java.lang.String path, java.lang.Object o)
path
- full path of the file to write too
- object to writepublic static java.lang.String encode(byte[] data)
public static java.lang.String quoteEscape(java.lang.String s)
public static java.lang.String removeJavadocTags(java.lang.String text)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |