Class 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
    • 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 - for any errors accessing or reading the object.
        SerializationException - for any formatting errors encountered while deserializing the object.
      • 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 - for any errors accessing or reading the object.
        SerializationException - for any formatting errors encountered while deserializing the object.
      • 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.
        Returns:
        The MIME type of the current data.