pivot.serialization
Class PropertiesSerializer

java.lang.Object
  extended by pivot.serialization.PropertiesSerializer
All Implemented Interfaces:
Serializer<Map<?,?>>

public class PropertiesSerializer
extends java.lang.Object
implements Serializer<Map<?,?>>

Implementation of the Serializer interface that reads data from and writes data to the Java properties file format.

Author:
smartini, gbrown

Field Summary
static java.lang.String MIME_TYPE
           
 
Constructor Summary
PropertiesSerializer()
           
 
Method Summary
 java.lang.String getMIMEType(Map<?,?> object)
          Returns the MIME type of the data read and written by this serializer.
 Map<?,?> readObject(java.io.InputStream inputStream)
          Reads data from a properties stream.
 void writeObject(Map<?,?> object, java.io.OutputStream outputStream)
          Writes data to a properties 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
Constructor Detail

PropertiesSerializer

public PropertiesSerializer()
Method Detail

readObject

public Map<?,?> readObject(java.io.InputStream inputStream)
                    throws java.io.IOException,
                           SerializationException
Reads data from a properties stream.

Specified by:
readObject in interface Serializer<Map<?,?>>
Parameters:
inputStream - The input stream from which data will be read.
Returns:
An instance of Map containing the data read from the properties file. Both keys and values are strings.
Throws:
java.io.IOException
SerializationException

writeObject

public void writeObject(Map<?,?> object,
                        java.io.OutputStream outputStream)
                 throws java.io.IOException,
                        SerializationException
Writes data to a properties stream.

Specified by:
writeObject in interface Serializer<Map<?,?>>
Parameters:
object - An instance of Map containing the data to be written to the properties file. Keys must be strings, and values will be converted to strings.
outputStream - The output stream to which data will be written.
Throws:
java.io.IOException
SerializationException

getMIMEType

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