|
|||||||||
| Home >> All >> org >> roller >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.roller.util
Class Utilities

java.lang.Objectorg.roller.util.Utilities
- public class Utilities
- extends java.lang.Object
General purpose utilities.
| Field Summary | |
private static org.apache.commons.logging.Log |
log
The Log instance for this class. |
| Constructor Summary | |
Utilities()
|
|
| Method Summary | |
static java.lang.String |
autoformat(java.lang.String s)
Autoformat. |
static void |
copyFile(java.io.File from,
java.io.File to)
|
static void |
copyInputToOutput(java.io.InputStream input,
java.io.OutputStream output)
|
static void |
copyInputToOutput(java.io.InputStream input,
java.io.OutputStream output,
long byteCount)
Utility method to copy an input stream to an output stream. |
static java.lang.String |
decodeString(java.lang.String str)
Decode a string using Base64 encoding. |
static java.lang.String |
encodePassword(java.lang.String password,
java.lang.String algorithm)
Encode a string using algorithm specified in web.xml and return the resulting encrypted password. |
static java.lang.String |
encodeString(java.lang.String str)
Encode a string using Base64 encoding. |
static java.lang.String |
escapeHTML(java.lang.String s)
Escape, but do not replace HTML. |
static java.lang.String |
escapeHTML(java.lang.String s,
boolean escapeAmpersand)
Escape, but do not replace HTML. |
static java.lang.String |
formatIso8601Date(java.util.Date d)
Format date in ISO-8601 format. |
static java.lang.String |
formatRfc822Date(java.util.Date date)
Return a date in RFC-822 format. |
static java.lang.String |
intArrayToString(int[] intArray)
Convert integer array to a string. |
static boolean |
isNotEmpty(java.lang.String str)
Utility methods for calling StringUtils since it cannot be instantiated and Utilties can. |
static java.lang.String |
removeAndEscapeHTML(java.lang.String s)
Run both removeHTML and escapeHTML on a string. |
static java.lang.String |
removeHTML(java.lang.String str)
Remove occurences of html, defined as any text between the characters "<" and ">". |
static java.lang.String |
removeNonAlphanumeric(java.lang.String str)
Remove occurences of non-alphanumeric characters. |
static java.lang.String |
replaceNonAlphanumeric(java.lang.String str)
Replaces occurences of non-alphanumeric characters with an underscore. |
static java.lang.String |
replaceNonAlphanumeric(java.lang.String str,
char subst)
Replaces occurences of non-alphanumeric characters with a supplied char. |
static java.lang.String |
stringReplace(java.lang.String str,
java.lang.String str1,
java.lang.String str2)
Replace occurrences of str1 in string str with str2 |
static java.lang.String |
stringReplace(java.lang.String str,
java.lang.String str1,
java.lang.String str2,
int maxCount)
Replace occurrences of str1 in string str with str2 |
static int[] |
stringToIntArray(java.lang.String instr,
java.lang.String delim)
Convert string to integer array. |
static java.lang.String[] |
stringToStringArray(java.lang.String instr,
java.lang.String delim)
Convert string to string array. |
static java.lang.String |
stripJsessionId(java.lang.String url)
Strip jsessionid off of a URL |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
log
private static org.apache.commons.logging.Log log
- The
Loginstance for this class.
| Constructor Detail |
Utilities
public Utilities()
| Method Detail |
isNotEmpty
public static boolean isNotEmpty(java.lang.String str)
- Utility methods for calling StringUtils since it cannot be
instantiated and Utilties can.
stripJsessionId
public static java.lang.String stripJsessionId(java.lang.String url)
- Strip jsessionid off of a URL
escapeHTML
public static java.lang.String escapeHTML(java.lang.String s)
- Escape, but do not replace HTML.
The default behaviour is to escape ampersands.
escapeHTML
public static java.lang.String escapeHTML(java.lang.String s, boolean escapeAmpersand)
- Escape, but do not replace HTML.
removeHTML
public static java.lang.String removeHTML(java.lang.String str)
- Remove occurences of html, defined as any text
between the characters "<" and ">".
removeAndEscapeHTML
public static java.lang.String removeAndEscapeHTML(java.lang.String s)
- Run both removeHTML and escapeHTML on a string.
autoformat
public static java.lang.String autoformat(java.lang.String s)
- Autoformat.
formatIso8601Date
public static java.lang.String formatIso8601Date(java.util.Date d)
- Format date in ISO-8601 format.
formatRfc822Date
public static java.lang.String formatRfc822Date(java.util.Date date)
- Return a date in RFC-822 format.
replaceNonAlphanumeric
public static java.lang.String replaceNonAlphanumeric(java.lang.String str)
- Replaces occurences of non-alphanumeric characters with an underscore.
replaceNonAlphanumeric
public static java.lang.String replaceNonAlphanumeric(java.lang.String str, char subst)
- Replaces occurences of non-alphanumeric characters with a
supplied char.
removeNonAlphanumeric
public static java.lang.String removeNonAlphanumeric(java.lang.String str)
- Remove occurences of non-alphanumeric characters.
stringReplace
public static java.lang.String stringReplace(java.lang.String str, java.lang.String str1, java.lang.String str2)
- Replace occurrences of str1 in string str with str2
stringReplace
public static java.lang.String stringReplace(java.lang.String str, java.lang.String str1, java.lang.String str2, int maxCount)
- Replace occurrences of str1 in string str with str2
stringToStringArray
public static java.lang.String[] stringToStringArray(java.lang.String instr, java.lang.String delim) throws java.util.NoSuchElementException, java.lang.NumberFormatException
- Convert string to string array.
stringToIntArray
public static int[] stringToIntArray(java.lang.String instr, java.lang.String delim) throws java.util.NoSuchElementException, java.lang.NumberFormatException
- Convert string to integer array.
intArrayToString
public static java.lang.String intArrayToString(int[] intArray)
- Convert integer array to a string.
copyFile
public static void copyFile(java.io.File from, java.io.File to) throws java.io.IOException
copyInputToOutput
public static void copyInputToOutput(java.io.InputStream input, java.io.OutputStream output, long byteCount) throws java.io.IOException
- Utility method to copy an input stream to an output stream.
Wraps both streams in buffers. Ensures right numbers of bytes copied.
copyInputToOutput
public static void copyInputToOutput(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
encodePassword
public static java.lang.String encodePassword(java.lang.String password, java.lang.String algorithm)
- Encode a string using algorithm specified in web.xml and return the
resulting encrypted password. If exception, the plain credentials
string is returned
encodeString
public static java.lang.String encodeString(java.lang.String str) throws java.io.IOException
- Encode a string using Base64 encoding. Used when storing passwords
as cookies.
This is weak encoding in that anyone can use the decodeString
routine to reverse the encoding.
decodeString
public static java.lang.String decodeString(java.lang.String str) throws java.io.IOException
- Decode a string using Base64 encoding.
|
|||||||||
| Home >> All >> org >> roller >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.roller.util.Utilities