|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.polliwog.Utilities
public class Utilities
Provides some general-purpose utilities.
Last Modified By: $Author: barrygently $ Last Modified On: $Date: 2005/07/04 14:00:01 $ Current Revision: $Revision: 1.6 $
Constructor Summary | |
---|---|
Utilities()
|
Method Summary | |
---|---|
static boolean |
between(java.util.Date d,
java.util.Date from,
java.util.Date to)
Return whether the date is between the from (inclusive) and to (inclusive). |
static java.lang.String |
buildXMLAttributes(java.util.Map attrs)
|
static java.lang.String |
formatTime(com.gentlyweb.utils.TimeDuration t,
java.lang.String format)
|
static java.lang.String |
formatTime(com.gentlyweb.utils.TimeDuration t,
java.lang.String dys,
java.lang.String hrs,
java.lang.String mns,
java.lang.String scs,
java.lang.String div)
|
static java.util.List |
getAllGroupByResults(org.josql.QueryResults qr)
|
static org.jdom.Element |
getAsElement(java.net.URL url,
java.lang.String zipExtension)
|
static java.lang.String |
getAsQueryString(java.util.Map parms)
|
static java.util.Map |
getHTTPStatusCodes()
Get all the status codes defined in class: HttpURLConnection. |
static int |
getPercent(int top,
int bot)
A utility to get the percentage of the top from the bottom. |
static int |
getPercent(long top,
long bot)
A utility to get the percentage of the top from the bottom. |
static java.util.Map |
getRequestParameters(java.lang.String q)
Convert a string into a Map of name/value pairs, based on URL parameter encoding. |
static java.net.URI |
getURI(java.lang.String u)
Convert the passed in string to a URI. |
static java.lang.String |
getValue(java.lang.StringBuffer buf,
java.lang.String openQuoteToken,
java.lang.String closeQuoteToken,
java.lang.String escapedBy)
Get the "next" value from the StringBuffer. |
static java.util.List |
getXMLPathParts(java.lang.String xp)
|
static java.lang.String |
getXMLValue(java.util.List xmlPathParts,
org.jdom.Element root)
|
static boolean |
startsWith(java.lang.String str,
java.util.List values)
Determine whether str starts with any of the values. |
static void |
tokenize(java.lang.String str,
java.lang.String token,
boolean trim,
java.util.List data)
Tokenize a string based on token. |
static void |
tokenize(java.lang.String str,
java.lang.String token,
boolean trim,
java.util.Map data)
Tokenize a string based on token. |
static void |
trimLeadingWhitespace(java.lang.StringBuffer buf)
Remove whitespace characters (as defined by Character.isWhitespace(char)) from the front of the passed in StringBuffer. |
static void |
writeHTMLFile(java.lang.String wrapper,
java.lang.String content,
java.io.File loc,
java.lang.Object o,
VisitorData vd,
Page p,
boolean compress)
|
static java.util.Date |
zeroTimeFields(java.util.Date d)
Zero the time fields of the passed in date. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utilities()
Method Detail |
---|
public static java.util.Map getRequestParameters(java.lang.String q)
q
- The string to break into the map.
public static void tokenize(java.lang.String str, java.lang.String token, boolean trim, java.util.Map data)
str
- The string to tokenize.token
- The string to tokenize on.trim
- If set to true
then each token found will be trimmed before
placing into data.data
- The Map to place the tokens into.public static boolean startsWith(java.lang.String str, java.util.List values)
str
- The string.values
- The list of values to check str against.
true
if str starts with any of the values, false
otherwise.public static void tokenize(java.lang.String str, java.lang.String token, boolean trim, java.util.List data)
str
- The string to tokenize.token
- The string to tokenize on.trim
- If set to true
then each token found will be trimmed before
placing into data.data
- The List to place the tokens into.public static java.net.URI getURI(java.lang.String u) throws WeblogException
u
- The string to convert to a URI.
WeblogException
- If the string cannot be converted to a URI.public static void trimLeadingWhitespace(java.lang.StringBuffer buf)
buf
- The buffer to trim.public static java.lang.String getValue(java.lang.StringBuffer buf, java.lang.String openQuoteToken, java.lang.String closeQuoteToken, java.lang.String escapedBy)
buf
- The buffer to get the value from.openQuoteToken
- The opening quote, set to null
if there isn't
one. The value returned will not contain this quote.closeQuoteToken
- The closing quote, set to null
if there isn't
one. The value returned will not contain this quote.escapedBy
- An escape character. The value returned will not contain this character
also only the first character is the string is used.
public static java.util.Map getHTTPStatusCodes()
public static boolean between(java.util.Date d, java.util.Date from, java.util.Date to)
d
- The date to check for.from
- The from date.to
- The to date.
true
if the date is between from and to, false
otherwise.public static java.util.Date zeroTimeFields(java.util.Date d)
d
- The date.
public static int getPercent(int top, int bot)
top
- The top part of the percentage i.e. 50/100.bot
- The bottom part of the percentage, i.e. 50/100.
public static int getPercent(long top, long bot)
top
- The top part of the percentage i.e. 50/100.bot
- The bottom part of the percentage, i.e. 50/100.
public static void writeHTMLFile(java.lang.String wrapper, java.lang.String content, java.io.File loc, java.lang.Object o, VisitorData vd, Page p, boolean compress) throws WeblogException
WeblogException
public static java.lang.String formatTime(com.gentlyweb.utils.TimeDuration t, java.lang.String format)
public static java.lang.String formatTime(com.gentlyweb.utils.TimeDuration t, java.lang.String dys, java.lang.String hrs, java.lang.String mns, java.lang.String scs, java.lang.String div)
public static java.lang.String getAsQueryString(java.util.Map parms)
public static java.lang.String buildXMLAttributes(java.util.Map attrs)
public static org.jdom.Element getAsElement(java.net.URL url, java.lang.String zipExtension) throws org.jdom.JDOMException, java.io.IOException
org.jdom.JDOMException
java.io.IOException
public static java.util.List getXMLPathParts(java.lang.String xp) throws WeblogException
WeblogException
public static java.lang.String getXMLValue(java.util.List xmlPathParts, org.jdom.Element root) throws org.jdom.JDOMException
org.jdom.JDOMException
public static java.util.List getAllGroupByResults(org.josql.QueryResults qr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |