|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xhtmlrenderer.util.GeneralUtil
public class GeneralUtil
Description of the Class
| Field Summary | |
|---|---|
static DecimalFormat |
PADDED_HASH_FORMAT
Used to format an Object's hashcode into a 0-padded 10 char String, e.g. |
| Constructor Summary | |
|---|---|
GeneralUtil()
|
|
| Method Summary | |
|---|---|
static String |
classNameOnly(Object o)
Given an Object instance, returns just the classname with no package |
static String |
classNameOnly(String cname)
Given a String classname, returns just the classname with no package |
static void |
dumpShortException(Exception ex)
Dumps an exception to the console, only the last 5 lines of the stack trace. |
static String |
escapeHTML(String s)
Converts any special characters into their corresponding HTML entities , for example < to <. |
static URL |
getURLFromClasspath(Object obj,
String resource)
|
static StringBuffer |
htmlEscapeSpace(String uri)
|
static String |
inputStreamToString(InputStream is)
Reads all content from a given InputStream into a String using the default platform encoding. |
static boolean |
isMacOSX()
|
static InputStream |
openStreamFromClasspath(Object obj,
String resource)
Description of the Method |
static String |
paddedHashCode(Object o)
Description of the Method |
static int |
parseIntRelaxed(String s)
Parses an integer from a string using less restrictive rules about which characters we won't accept. |
static String |
trackBack(int cnt)
Returns a String tracking the last n method calls, from oldest to most recent. |
static void |
writeStringToFile(String content,
String encoding,
String fileName)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final DecimalFormat PADDED_HASH_FORMAT
| Constructor Detail |
|---|
public GeneralUtil()
| Method Detail |
|---|
public static InputStream openStreamFromClasspath(Object obj,
String resource)
obj - PARAMresource - PARAM
public static URL getURLFromClasspath(Object obj,
String resource)
public static void dumpShortException(Exception ex)
ex - PARAMpublic static String trackBack(int cnt)
trackBack() call
from. Example:
// called from Box.calcBorders(), line 639 String tback = GeneralUtil.trackBack(6); System.out.println(tback);produces
Boxing.layoutChildren(ln 204) BlockBoxing.layoutContent(ln 81) Boxing.layout(ln 72) Boxing.layout(ln 133) Box.totalLeftPadding(ln 306) Box.calcBorders(ln 639)The
trackBack() method itself is always excluded from the dump.
Note the output may not be useful if HotSpot has been optimizing the
code.
cnt - How far back in the call tree to go; if call tree is smaller, will
be limited to call tree.
public static String classNameOnly(Object o)
o - PARAM
public static String classNameOnly(String cname)
cname - PARAM
public static String paddedHashCode(Object o)
o - PARAM
public static boolean isMacOSX()
public static StringBuffer htmlEscapeSpace(String uri)
public static String inputStreamToString(InputStream is)
throws IOException
is - the InputStream to read from. Must already be open, and will NOT be closed by this function. Failing to
close this stream after the call will result in a resource leak.
IOException - if the stream could not be read
public static void writeStringToFile(String content,
String encoding,
String fileName)
throws IOException
IOExceptionpublic static int parseIntRelaxed(String s)
s - The string to parse
public static String escapeHTML(String s)
s - The String which may contain characters to escape.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||