接口 Deserializer<T>

类型参数:
T - the object type
所有已知实现类:
DefaultDeserializer, SerializationDelegate
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface public interface Deserializer<T>
A strategy interface for converting from data in an InputStream to an Object.
从以下版本开始:
4.0
作者:
Gary Russell, Mark Fisher, Juergen Hoeller
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    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.
  • 方法详细资料

    • 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.

      参数:
      inputStream - the input stream
      返回:
      the deserialized object
      抛出:
      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.
      参数:
      serialized - the byte array
      返回:
      the deserialized object
      抛出:
      IOException - in case of deserialization failure