Interface Deserializer<T>

Type Parameters:
T - the object type
All Known Implementing Classes:
DefaultDeserializer, SerializationDelegate
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Deserializer<T>
A strategy interface for converting from data in an InputStream to an Object.
Since:
3.0.5
Author:
Gary Russell, Mark Fisher, Juergen Hoeller
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(InputStream inputStream)
    Read (assemble) an object of type T from the given InputStream.
    default T
    deserializeFromByteArray(byte[] serialized)
    Read (assemble) an object of type T from the given byte array.
  • Method Details

    • deserialize

      T deserialize(InputStream inputStream) throws IOException
      Read (assemble) an object of type T from the given InputStream.

      Note: Implementations should not close the given InputStream (or any decorators of that InputStream) but rather leave this up to the caller.

      Parameters:
      inputStream - the input stream
      Returns:
      the deserialized object
      Throws:
      IOException - in case of errors reading from the stream
    • deserializeFromByteArray

      default T deserializeFromByteArray(byte[] serialized) throws IOException
      Read (assemble) an object of type T from the given byte array.
      Parameters:
      serialized - the byte array
      Returns:
      the deserialized object
      Throws:
      IOException - in case of deserialization failure
      Since:
      5.2.7