Class JdkSerializer

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.io.ObjectInputStream createObjectInput​(java.io.InputStream inputStream, java.lang.Class<?> requiredType)  
      protected java.io.ObjectOutputStream createObjectOutput​(java.io.OutputStream outputStream)  
      <T> java.util.Optional<T> deserialize​(java.io.InputStream inputStream, Argument<T> requiredType)
      Deserialize the given object to bytes.
      <T> java.util.Optional<T> deserialize​(java.io.InputStream inputStream, java.lang.Class<T> requiredType)
      Deserialize the given object to bytes.
      void serialize​(java.lang.Object object, java.io.OutputStream outputStream)
      Serialize the given object to a byte[].
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JdkSerializer

        public JdkSerializer​(ConversionService<?> conversionService)
        Parameters:
        conversionService - The conversion service
      • JdkSerializer

        public JdkSerializer()
        Default constructor.
    • Method Detail

      • serialize

        public void serialize​(java.lang.Object object,
                              java.io.OutputStream outputStream)
                       throws SerializationException
        Description copied from interface: ObjectSerializer
        Serialize the given object to a byte[].
        Specified by:
        serialize in interface ObjectSerializer
        Parameters:
        object - The object to serialize
        outputStream - The output stream
        Throws:
        SerializationException - if there is a serialization problem
      • deserialize

        public <T> java.util.Optional<T> deserialize​(java.io.InputStream inputStream,
                                                     java.lang.Class<T> requiredType)
                                              throws SerializationException
        Description copied from interface: ObjectSerializer
        Deserialize the given object to bytes.
        Specified by:
        deserialize in interface ObjectSerializer
        Type Parameters:
        T - The required generic type
        Parameters:
        inputStream - The input stream
        requiredType - The required type
        Returns:
        An Optional of the object
        Throws:
        SerializationException - if there is a serialization problem
      • deserialize

        public <T> java.util.Optional<T> deserialize​(java.io.InputStream inputStream,
                                                     Argument<T> requiredType)
                                              throws SerializationException
        Description copied from interface: ObjectSerializer
        Deserialize the given object to bytes.
        Specified by:
        deserialize in interface ObjectSerializer
        Type Parameters:
        T - The required generic type
        Parameters:
        inputStream - The input stream
        requiredType - The required type
        Returns:
        An Optional of the object
        Throws:
        SerializationException - if there is a serialization problem
      • createObjectOutput

        protected java.io.ObjectOutputStream createObjectOutput​(java.io.OutputStream outputStream)
                                                         throws java.io.IOException
        Parameters:
        outputStream - The output stream
        Returns:
        A new ObjectOutputStream
        Throws:
        java.io.IOException - if there is an error
      • createObjectInput

        protected java.io.ObjectInputStream createObjectInput​(java.io.InputStream inputStream,
                                                              java.lang.Class<?> requiredType)
                                                       throws java.io.IOException
        Parameters:
        inputStream - The input stream
        requiredType - The required type
        Returns:
        A ObjectOutputStream
        Throws:
        java.io.IOException - if there is an error