org.apache.tapestry.util.io
Class SerializableAdaptor

java.lang.Object
  extended by org.apache.tapestry.util.io.SerializableAdaptor
All Implemented Interfaces:
SqueezeAdaptor

public class SerializableAdaptor
extends Object
implements SqueezeAdaptor

The most complicated of the adaptors, this one takes an arbitrary serializable object, serializes it to binary (possibly compressing the stream along the way), and encodes it in a Base64 encoding. The first character of the squeezed stream indicates whether it is or is not encoded.

Author:
Howard Lewis Ship

Constructor Summary
SerializableAdaptor()
           
 
Method Summary
 Class getDataClass()
          Returns the class (or interface) which can be encoded by this adaptor.
 String getPrefix()
          Returns one or more characters, each of which will be a prefix for this adaptor.
 void setResolver(org.apache.hivemind.ClassResolver resolver)
           
 String squeeze(DataSqueezer squeezer, Object data)
          Converts the data object into a String.
 Object unsqueeze(DataSqueezer squeezer, String encoded)
          Converts a String back into an appropriate object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializableAdaptor

public SerializableAdaptor()
Method Detail

getPrefix

public String getPrefix()
Description copied from interface: SqueezeAdaptor
Returns one or more characters, each of which will be a prefix for this adaptor.

Specified by:
getPrefix in interface SqueezeAdaptor
Returns:
The prefix for this squeezer.

getDataClass

public Class getDataClass()
Description copied from interface: SqueezeAdaptor
Returns the class (or interface) which can be encoded by this adaptor.

Specified by:
getDataClass in interface SqueezeAdaptor
Returns:
The class type that this adaptor can manage.

squeeze

public String squeeze(DataSqueezer squeezer,
                      Object data)
Description copied from interface: SqueezeAdaptor
Converts the data object into a String.

Specified by:
squeeze in interface SqueezeAdaptor
Parameters:
squeezer - The squeezer that should be used to ultimately squeeze the data.
data - The data to squeeze.
Returns:
String representation of data.

unsqueeze

public Object unsqueeze(DataSqueezer squeezer,
                        String encoded)
Description copied from interface: SqueezeAdaptor
Converts a String back into an appropriate object.

Specified by:
unsqueeze in interface SqueezeAdaptor
Parameters:
squeezer - The squeezer to use to unsqueeze the data.
encoded - The string data - as was returned from SqueezeAdaptor.squeeze(org.apache.tapestry.services.DataSqueezer, Object).
Returns:
The re-constituded object representation of the string.

setResolver

public void setResolver(org.apache.hivemind.ClassResolver resolver)


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.