| java.lang.Object org.apache.roller.util.Utilities
Utilities | public class Utilities (Code) | | General purpose utilities, not for use in templates.
|
Method Summary | |
public static String | autoformat(String s) Autoformat. | public static void | copyFile(File from, File to) | public static void | copyInputToOutput(InputStream input, OutputStream output, long byteCount) Utility method to copy an input stream to an output stream.
Wraps both streams in buffers. | public static void | copyInputToOutput(InputStream input, OutputStream output) | final public static String | decode(String s) URL decoding. | public static String | decodeString(String str) Decode a string using Base64 encoding. | final public static String | encode(String s) URL encoding. | public static String | encodeEmail(String str) | public static String | encodePassword(String password, String algorithm) Encode a string using algorithm specified in web.xml and return the
resulting encrypted password. | public static String | encodeString(String str) Encode a string using Base64 encoding. | public static String | escapeHTML(String s) Escape, but do not replace HTML. | public static String | escapeHTML(String s, boolean escapeAmpersand) Escape, but do not replace HTML. | public static String | extractHTML(String str) Extract (keep) JUST the HTML from the String. | public static String | hexEncode(String str) | public static String | intArrayToString(int[] intArray) Convert integer array to a string. | public static String | normalizeTag(String tag, Locale locale) | public static String | removeAndEscapeHTML(String s) Run both removeHTML and escapeHTML on a string.
Parameters: s - String to be run through removeHTML and escapeHTML. | public static String | removeHTML(String str) Remove occurences of html, defined as any text
between the characters "<" and ">". | public static String | removeHTML(String str, boolean addSpace) Remove occurences of html, defined as any text
between the characters "<" and ">". | public static String | removeNonAlphanumeric(String str) Remove occurences of non-alphanumeric characters. | public static String | replaceNonAlphanumeric(String str) Replaces occurences of non-alphanumeric characters with an underscore. | public static String | replaceNonAlphanumeric(String str, char subst) Replaces occurences of non-alphanumeric characters with a
supplied char. | public static List | splitStringAsTags(String tags) | public static String | stringArrayToString(String[] stringArray, String delim) | public static int | stringToInt(String string) | public static int[] | stringToIntArray(String instr, String delim) Convert string to integer array. | public static String[] | stringToStringArray(String instr, String delim) Convert string to string array. | public static String | stripInvalidTagCharacters(String tag) | public static String | stripJsessionId(String url) | public static String | toBase64(byte[] aValue) | public static String | truncate(String str, int lower, int upper, String appendToEnd) Strips HTML and truncates. | public static String | truncateNicely(String str, int lower, int upper, String appendToEnd) This method based on code from the String taglib at Apache Jakarta:
http://cvs.apache.org/viewcvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/StringW.java?rev=1.16&content-type=text/vnd.viewcvs-markup
Copyright (c) 1999 The Apache Software Foundation. | public static String | truncateText(String str, int lower, int upper, String appendToEnd) | public static String | unescapeHTML(String str) |
TAG_SPLIT_CHARS | final public static String TAG_SPLIT_CHARS(Code) | | |
copyInputToOutput | public static void copyInputToOutput(InputStream input, OutputStream output, long byteCount) throws IOException(Code) | | Utility method to copy an input stream to an output stream.
Wraps both streams in buffers. Ensures right numbers of bytes copied.
|
decode | final public static String decode(String s)(Code) | | URL decoding.
Parameters: s - a URL-encoded string to be URL-decoded URL decoded value of s using character encoding UTF-8; null if s is null. |
encode | final public static String encode(String s)(Code) | | URL encoding.
Parameters: s - a string to be URL-encoded URL encoding of s using character encoding UTF-8; null if s is null. |
encodePassword | public static String encodePassword(String password, String algorithm)(Code) | | Encode a string using algorithm specified in web.xml and return the
resulting encrypted password. If exception, the plain credentials
string is returned
Parameters: password - Password or other credentials to use in authenticatingthis username Parameters: algorithm - Algorithm used to do the digest encypted password based on the algorithm. |
encodeString | public static String encodeString(String str) throws IOException(Code) | | 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.
Parameters: str - String throws: IOException - |
escapeHTML | public static String escapeHTML(String s)(Code) | | Escape, but do not replace HTML.
The default behaviour is to escape ampersands.
|
escapeHTML | public static String escapeHTML(String s, boolean escapeAmpersand)(Code) | | Escape, but do not replace HTML.
Parameters: escapeAmpersand - Optionally escapeampersands (&). |
extractHTML | public static String extractHTML(String str)(Code) | | Extract (keep) JUST the HTML from the String.
Parameters: str - |
intArrayToString | public static String intArrayToString(int[] intArray)(Code) | | Convert integer array to a string.
|
removeAndEscapeHTML | public static String removeAndEscapeHTML(String s)(Code) | | Run both removeHTML and escapeHTML on a string.
Parameters: s - String to be run through removeHTML and escapeHTML. String with HTML removed and HTML special characters escaped. |
removeHTML | public static String removeHTML(String str)(Code) | | Remove occurences of html, defined as any text
between the characters "<" and ">". Replace
any HTML tags with a space.
|
removeHTML | public static String removeHTML(String str, boolean addSpace)(Code) | | Remove occurences of html, defined as any text
between the characters "<" and ">".
Optionally replace HTML tags with a space.
Parameters: str - Parameters: addSpace - |
removeNonAlphanumeric | public static String removeNonAlphanumeric(String str)(Code) | | Remove occurences of non-alphanumeric characters.
|
replaceNonAlphanumeric | public static String replaceNonAlphanumeric(String str)(Code) | | Replaces occurences of non-alphanumeric characters with an underscore.
|
replaceNonAlphanumeric | public static String replaceNonAlphanumeric(String str, char subst)(Code) | | Replaces occurences of non-alphanumeric characters with a
supplied char.
|
splitStringAsTags | public static List splitStringAsTags(String tags)(Code) | | Parameters: tags - |
stringArrayToString | public static String stringArrayToString(String[] stringArray, String delim)(Code) | | Parameters: stringArray - Parameters: delim - |
stringToInt | public static int stringToInt(String string)(Code) | | Parameters: string - |
stripInvalidTagCharacters | public static String stripInvalidTagCharacters(String tag)(Code) | | Parameters: tag - |
stripJsessionId | public static String stripJsessionId(String url)(Code) | | Strip jsessionid off of a URL
|
toBase64 | public static String toBase64(byte[] aValue)(Code) | | Convert a byte array into a Base64 string (as used in mime formats)
|
truncate | public static String truncate(String str, int lower, int upper, String appendToEnd)(Code) | | Strips HTML and truncates.
|
truncateNicely | public static String truncateNicely(String str, int lower, int upper, String appendToEnd)(Code) | | This method based on code from the String taglib at Apache Jakarta:
http://cvs.apache.org/viewcvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/StringW.java?rev=1.16&content-type=text/vnd.viewcvs-markup
Copyright (c) 1999 The Apache Software Foundation.
Author: timster@mac.com
Parameters: str - Parameters: lower - Parameters: upper - Parameters: appendToEnd - |
|
|