Package org.springframework.core.serializer

# Class DefaultDeserializer

java.lang.Object
org.springframework.core.serializer.DefaultDeserializer

All Implemented Interfaces:
  `Deserializer<Object>`

public class DefaultDeserializer extends Object implements Deserializer<Object>
A default `Deserializer` implementation that reads an input stream using Java serialization.

Since:
  3.0.5
Author:
  Gary Russell, Mark Fisher, Juergen Hoeller
See Also:
  - `ObjectInputStream`

## Constructor Summary

Constructors
Constructor
Description
`DefaultDeserializer()`
Create a `DefaultDeserializer` with default `ObjectInputStream` configuration, using the "latest user-defined ClassLoader".
`DefaultDeserializer(ClassLoader classLoader)`
Create a `DefaultDeserializer` for using an `ObjectInputStream` with the given `ClassLoader`.

## Method Summary

Modifier and Type
Method
Description
`Object`
`deserialize(InputStream inputStream)`
Read from the supplied `InputStream` and deserialize the contents into an object.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.core.serializer.Deserializer

`deserializeFromByteArray`

## Constructor Details

### DefaultDeserializer

public DefaultDeserializer()
Create a `DefaultDeserializer` with default `ObjectInputStream` configuration, using the "latest user-defined ClassLoader".

### DefaultDeserializer

public DefaultDeserializer(@Nullable ClassLoader classLoader)
Create a `DefaultDeserializer` for using an `ObjectInputStream` with the given `ClassLoader`.

Parameters:
  `classLoader` - the ClassLoader to use
Since:
  4.2.1
See Also:
  - `ConfigurableObjectInputStream(InputStream, ClassLoader)`

## Method Details

### deserialize

public Object deserialize(InputStream inputStream) throws IOException
Read from the supplied `InputStream` and deserialize the contents into an object.

Specified by:
  `deserialize` in interface `Deserializer<Object>`
Parameters:
  `inputStream` - the input stream
Returns:
  the deserialized object
Throws:
  `IOException` - in case of errors reading from the stream
See Also:
  - `ObjectInputStream.readObject()`