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 java.lang.Object
implements SqueezeAdaptor

The most complicated of the adaptors, this one takes an arbitrary serializable object, serializes it to binary (possibly encoding it), and encodes it in a Base64 encoding.

Encoding and decoding of Base64 strings uses code adapted from work in the public domain originally written by Jonathan Knudsen and published in O'reilly's "Java Cryptography". Note that we use a modified form of Base64 encoding, with URL-safe characters to encode the 62 and 63 values and the pad character.

TBD: Work out some class loader issues involved in deserializing.

Author:
Howard Lewis Ship

Constructor Summary
SerializableAdaptor()
           
 
Method Summary
 java.lang.Class getDataClass()
          Returns the class (or interface) which can be encoded by this adaptor.
 java.lang.String getPrefix()
          Returns one or more characters, each of which will be a prefix for this adaptor.
 void setResolver(org.apache.hivemind.ClassResolver resolver)
           
 java.lang.String squeeze(DataSqueezer squeezer, java.lang.Object data)
          Converts the data object into a String.
 java.lang.Object unsqueeze(DataSqueezer squeezer, java.lang.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 java.lang.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

getDataClass

public java.lang.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

squeeze

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

Specified by:
squeeze in interface SqueezeAdaptor

unsqueeze

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

Specified by:
unsqueeze in interface SqueezeAdaptor

setResolver

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