public interface Serializer<T> extends Serializable
| Modifier and Type | Method and Description |
|---|---|
T |
copy(T from)
Creates a deep copy of the given element in a new element.
|
T |
deserialize(DataInputView source)
De-serializes a record from the given source input view.
|
default T |
deserializeFromString(String s)
De-serializes a record from string.
|
Serializer<T> |
duplicate()
Creates a deep copy of this serializer if it is necessary, i.e.
|
void |
serialize(T record,
DataOutputView target)
Serializes the given record to the given target output view.
|
default String |
serializeToString(T record)
Serializes the given record to string.
|
Serializer<T> duplicate()
We need this because Serializers might be used in several threads. Stateless serializers are inherently thread-safe while stateful serializers might not be thread-safe.
T copy(T from)
from - The element reuse be copied.void serialize(T record, DataOutputView target) throws IOException
record - The record to serialize.target - The output view to write the serialized data to.IOException - Thrown, if the serialization encountered an I/O related error. Typically
raised by the output view, which may have an underlying I/O channel to which it
delegates.T deserialize(DataInputView source) throws IOException
source - The input view from which to read the data.IOException - Thrown, if the de-serialization encountered an I/O related error.
Typically raised by the input view, which may have an underlying I/O channel from which
it reads.default String serializeToString(T record)
record - The record to serialize.Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.