Package org.apache.hadoop.io.serializer
Interface Deserializer<T>
- Type Parameters:
T- generic type.
@LimitedPrivate({"HDFS","MapReduce"})
@Evolving
public interface Deserializer<T>
Provides a facility for deserializing objects of type <T> from an
InputStream.
Deserializers are stateful, but must not buffer the input since
other producers may read from the input between calls to
deserialize(Object).
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the underlying input stream and clear up any resources.deserialize(T t) Deserialize the next object from the underlying input stream.voidopen(InputStream in) Prepare the deserializer for reading.
-
Method Details
-
open
Prepare the deserializer for reading.
- Parameters:
in- input stream.- Throws:
IOException- raised on errors performing I/O.
-
deserialize
Deserialize the next object from the underlying input stream. If the object
tis non-null then this deserializer may set its internal state to the next object read from the input stream. Otherwise, if the objecttis null a new deserialized object will be created.- Parameters:
t- t.- Returns:
- the deserialized object
- Throws:
IOException- raised on errors performing I/O.
-
close
Close the underlying input stream and clear up any resources.
- Throws:
IOException- raised on errors performing I/O.
-