Class AbstractSerializer

    • Method Detail

      • serialize

        public Data<byte[]> serialize​(Object object)
        Description copied from interface: Serializer
        Serializes an object to a Data object containing a byte array.
        Specified by:
        serialize in interface Serializer
        Parameters:
        object - The instance to serialize
        Returns:
        Data object containing byte array representation of the object
      • getObjectType

        protected String getObjectType​(Object object)
      • deserialize

        public <S extends SerializedObject<byte[],​S>> Stream<DeserializingObject<byte[],​S>> deserialize​(Stream<S> dataStream,
                                                                                                                    boolean failOnUnknownType)
        Description copied from interface: Serializer
        Upcasts and deserializes a stream of serialized objects. Each result in the output stream contains both a provider for the deserialized object and the serialized object after upcasting that is used as the source of the deserialized object.

        Deserialization is performed lazily. This means that actual conversion for a given result in the output stream only happens if DeserializingObject.getPayload() is invoked on the result. This has the advantage that a caller can inspect what type will be returned via DeserializingObject.getSerializedObject() before deciding to go through with the deserialization.

        You can specify whether deserialization of a result in the output stream should fail with a SerializationException if a type is unknown (not a class). It is up to the implementation to determine what should happen if a type is unknown but the failOnUnknownType flag is false.

        Specified by:
        deserialize in interface Serializer
        Type Parameters:
        S - the type of the serialized object
        Parameters:
        dataStream - data input stream to deserialize
        failOnUnknownType - flag that determines whether deserialization of an unknown type should give an exception
        Returns:
        a stream containing deserialization results