org.apache.pivot.serialization
Class PropertiesSerializer
java.lang.Object
org.apache.pivot.serialization.PropertiesSerializer
- All Implemented Interfaces:
- Serializer<Map<?,?>>
public class PropertiesSerializer
- extends Object
- implements Serializer<Map<?,?>>
Implementation of the Serializer
interface that reads data from
and writes data to the Java properties file format.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROPERTIES_EXTENSION
public static final String PROPERTIES_EXTENSION
- See Also:
- Constant Field Values
MIME_TYPE
public static final String MIME_TYPE
- See Also:
- Constant Field Values
PropertiesSerializer
public PropertiesSerializer()
readObject
public Map<?,?> readObject(InputStream inputStream)
throws 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:
IOException
SerializationException
writeObject
public void writeObject(Map<?,?> object,
OutputStream outputStream)
throws 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:
IOException
SerializationException
getMIMEType
public 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.