pivot.serialization
Class BinarySerializer

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

public class BinarySerializer
extends java.lang.Object
implements Serializer<java.lang.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 java.lang.String CLASS_PARAMETER
           
static java.lang.String MIME_TYPE
           
 
Constructor Summary
BinarySerializer()
           
 
Method Summary
 java.lang.String getMIMEType(java.lang.Object object)
          Returns the MIME type of the data read and written by this serializer.
 java.lang.Object readObject(java.io.InputStream inputStream)
          Reads a graph of serialized objects from an input stream.
 void writeObject(java.lang.Object object, java.io.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 java.lang.String MIME_TYPE
See Also:
Constant Field Values

CLASS_PARAMETER

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

BinarySerializer

public BinarySerializer()
Method Detail

readObject

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

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

writeObject

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

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

getMIMEType

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