pivot.serialization
Class BinarySerializer

java.lang.Object
  extended by pivot.serialization.BinarySerializer
All Implemented Interfaces:
Serializer<Object>

public class BinarySerializer
extends Object
implements Serializer<Object>

Implementation of the Serializer interface that uses Java's internal serialization mechanism to read and write values. All values in the object hierarchy are required to implement Serializable.

Author:
gbrown

Field Summary
static String CLASS_PARAMETER
           
static String MIME_TYPE
           
 
Constructor Summary
BinarySerializer()
           
 
Method Summary
 String getMIMEType(Object object)
          Returns the MIME type of the data read and written by this serializer.
 Object readObject(InputStream inputStream)
          Reads a graph of serialized objects from an input stream.
 void writeObject(Object object, OutputStream outputStream)
          Writes a graph of serializable objects to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIME_TYPE

public static final String MIME_TYPE
See Also:
Constant Field Values

CLASS_PARAMETER

public static final String CLASS_PARAMETER
See Also:
Constant Field Values
Constructor Detail

BinarySerializer

public BinarySerializer()
Method Detail

readObject

public Object readObject(InputStream inputStream)
                  throws IOException,
                         SerializationException
Reads a graph of serialized objects from an input stream.

Specified by:
readObject in interface Serializer<Object>
Parameters:
inputStream - The data stream from which the object will be read.
Returns:
The deserialized object.
Throws:
IOException
SerializationException

writeObject

public void writeObject(Object object,
                        OutputStream outputStream)
                 throws IOException,
                        SerializationException
Writes a graph of serializable objects to an output stream.

Specified by:
writeObject in interface Serializer<Object>
Parameters:
object - The object to serialize.
outputStream - The data stream to which the object will be written.
Throws:
IOException
SerializationException

getMIMEType

public String getMIMEType(Object object)
Description copied from interface: Serializer
Returns the MIME type of the data read and written by this serializer.

Specified by:
getMIMEType in interface Serializer<Object>
Parameters:
object - If provided, allows the serializer to attach parameters to the returned MIME type containing more detailed information about the data. If null, the base MIME type is returned.