|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tapestry.util.io.DataSqueezer
public class DataSqueezer
A class used to convert arbitrary objects to Strings and back. This has particular uses involving HTTP URLs and Cookies.
| Constructor Summary | |
|---|---|
DataSqueezer(IResourceResolver resolver)
Creates a new squeezer with the default set of adaptors. |
|
DataSqueezer(IResourceResolver resolver,
ISqueezeAdaptor[] adaptors)
Creates a new data squeezer, which will have the default set of adaptors, and may add additional adaptors. |
|
| Method Summary | |
|---|---|
IResourceResolver |
getResolver()
Returns the resource resolver used with this squeezer. |
boolean |
isPrefixRegistered(char prefix)
Checks to see if a given prefix character has a registered adaptor. |
void |
register(String prefix,
Class dataClass,
ISqueezeAdaptor adaptor)
Registers the adaptor with one or more single-character prefixes. |
String |
squeeze(Object data)
Squeezes the data object into a String by locating an appropriate adaptor that can perform the conversion. |
String[] |
squeeze(Object[] data)
A convience; invokes squeeze(Object) for each element in the
data array. |
String |
toString()
|
Object |
unsqueeze(String string)
Unsqueezes the string. |
Object[] |
unsqueeze(String[] strings)
Convienience method for unsqueezing many strings (back into objects). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DataSqueezer(IResourceResolver resolver)
public DataSqueezer(IResourceResolver resolver,
ISqueezeAdaptor[] adaptors)
adaptors - an optional list of adaptors that will be registered to
the data squeezer (it may be null or empty)| Method Detail |
|---|
public void register(String prefix,
Class dataClass,
ISqueezeAdaptor adaptor)
prefix - one or more characters, each of which will be a prefix for
the adaptor.dataClass - the class (or interface) which can be encoded by the adaptor.adaptor - the adaptor which to be registered.
public String squeeze(Object data)
throws IOException
IOException
public String[] squeeze(Object[] data)
throws IOException
squeeze(Object) for each element in the
data array. If data is null, returns null.
IOException
public Object unsqueeze(String string)
throws IOException
IOException
public Object[] unsqueeze(String[] strings)
throws IOException
If strings is null, returns null.
IOExceptionpublic boolean isPrefixRegistered(char prefix)
public String toString()
toString in class Objectpublic IResourceResolver getResolver()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||