Class 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.
    Note that for better security, you should only use BinarySerializer in QueryServlet if you're sure the incoming requests will only come from trusted sources.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CLASS_PARAMETER  
      static java.lang.String MIME_TYPE  
    • Method Summary

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