|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.shotoku.tools.Tools
public class Tools
Utility, helper functions used internally.
| Constructor Summary | |
|---|---|
Tools()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
addPaths(java.lang.String path1,
java.lang.String path2)
Concatenates two parts of a path into 1: returns a string path1/path2. |
static void |
checkName(java.lang.String name)
|
static java.lang.String |
concatenatePaths(java.lang.String path1,
java.lang.String path2)
Concatenates two parts of a path into 1: returns a string path1/path2, only with the necessary slashes
(so running normalizeSlashes(String) won't have any effect
on the string). |
static java.lang.String |
concatenateProperties(java.lang.String property1,
java.lang.String property2)
Concatenates two parts of a property name: returns a string property1.property2. |
static java.io.File |
createTemporaryFile()
|
static java.lang.String |
decodeURL(java.lang.String s)
Decodes the given string from aa URL-friendly format (calls URLDecoder.decodeURL). |
static java.lang.String |
encodeURL(java.lang.String s)
Encodes the given string to an URL-friendly format (calls URLEncoder.encodeURL). |
static java.lang.String |
getAttributeValue(org.w3c.dom.Node root,
java.lang.String attrName)
From the given node, gets the value of the specified attribute. |
static java.nio.ByteBuffer |
getFileBytes(java.io.File file)
|
static java.lang.String |
getFileString(java.io.File file)
|
static java.util.Map<java.lang.String,java.lang.String> |
getMapFromNodeAttributes(org.w3c.dom.Node root)
Reads all attributes of the given node and returns them as a map. |
static java.lang.String |
getNameBasedMimeType(java.io.File file)
|
static java.lang.String |
getNameBasedMimeType(java.lang.String name)
|
static org.w3c.dom.Node |
getNamedNode(org.w3c.dom.Node root,
java.lang.String name)
|
static ShotokuService |
getService()
|
static boolean |
isEmpty(java.lang.String s)
Checks if the given string is empty (null or ""). |
static boolean |
isOutsideLink(java.lang.String link)
Checks if the link is an outside link. |
static boolean |
isTrue(java.lang.String s)
Checks if the given string represents a true value. |
static java.lang.String |
normalizeSlashes(java.lang.String toNormalize,
boolean startingSlash)
From the given string, removes unnecessary / in the middle and ending. |
static boolean |
objectsEqual(java.lang.Object obj1,
java.lang.Object obj2)
Checks if two objects are equal - either both null, or their equals method returns true. |
static java.lang.String |
toString(java.lang.Object o)
Converts the given object to a String in a null-safe way. |
static java.lang.String |
toStringNotNull(java.lang.Object o)
Converts the given object to a String in a null-safe way. |
static void |
transfer(java.io.InputStream is,
java.io.OutputStream os)
Transferes all bytes from the given input stream to the given output stream. |
static void |
transfer(java.io.InputStream is,
java.io.PrintWriter w)
Transferes all bytes from the given input stream to the given output stream. |
static java.lang.String |
unmarshallText(org.w3c.dom.Node textNode)
Reads text contained in a tag of the form |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Tools()
| Method Detail |
|---|
public static ShotokuService getService()
public static java.lang.String unmarshallText(org.w3c.dom.Node textNode)
textNode - Node to read text from.
public static org.w3c.dom.Node getNamedNode(org.w3c.dom.Node root,
java.lang.String name)
root - Node which children should be searched.name - Name of the node that is being searched.
public static java.lang.String getAttributeValue(org.w3c.dom.Node root,
java.lang.String attrName)
root - Node to read the attribute from.attrName - Name of the attribute to read.
public static java.util.Map<java.lang.String,java.lang.String> getMapFromNodeAttributes(org.w3c.dom.Node root)
root - Node from which to read the attributes.
public static java.lang.String normalizeSlashes(java.lang.String toNormalize,
boolean startingSlash)
toNormalize - String to normalize.startingSlash - True if the returned string should have a / in
the beginning.
toNormalize with unnecessary / removed.
public static java.lang.String concatenatePaths(java.lang.String path1,
java.lang.String path2)
path1/path2, only with the necessary slashes
(so running normalizeSlashes(String) won't have any effect
on the string).
path1 - First path to concatenate.path2 - Second path to concatenate.
path1/path2
public static java.lang.String concatenateProperties(java.lang.String property1,
java.lang.String property2)
property1.property2.
property1 - First property part to concatenate.property2 - Second property part to concatenate.
property1.property2
public static java.lang.String addPaths(java.lang.String path1,
java.lang.String path2)
path1/path2.
path1 - First path to concatenate.path2 - Second path to concatenate.
path1/path2public static boolean isEmpty(java.lang.String s)
public static java.lang.String toString(java.lang.Object o)
o - Object to convert.
public static java.lang.String toStringNotNull(java.lang.Object o)
o - Object to convert.
public static java.lang.String encodeURL(java.lang.String s)
s - String to encodeURL.
public static java.lang.String decodeURL(java.lang.String s)
s - String to decodeURL.
public static boolean objectsEqual(java.lang.Object obj1,
java.lang.Object obj2)
obj1 - First object to compare.obj2 - Second object to compare.
public static boolean isOutsideLink(java.lang.String link)
link - Link to check.
public static void transfer(java.io.InputStream is,
java.io.OutputStream os)
throws java.io.IOException
is - Input stream to read from.os - Output stream to write to.
java.io.IOException
public static void transfer(java.io.InputStream is,
java.io.PrintWriter w)
throws java.io.IOException
is - Input stream to read from.w - Printwriter to write to.
java.io.IOExceptionpublic static boolean isTrue(java.lang.String s)
s - String to check.
public static void checkName(java.lang.String name)
throws NameFormatException
NameFormatException
public static java.nio.ByteBuffer getFileBytes(java.io.File file)
throws java.io.IOException
file - File to read from.
java.io.IOException
public static java.lang.String getFileString(java.io.File file)
throws java.io.IOException
file - File to read from.
java.io.IOExceptionpublic static java.io.File createTemporaryFile()
public static java.lang.String getNameBasedMimeType(java.lang.String name)
public static java.lang.String getNameBasedMimeType(java.io.File file)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||