Package org.apache.flink.core.io
Class SimpleVersionedSerializerAdapter<T>
- java.lang.Object
-
- org.apache.flink.core.io.SimpleVersionedSerializerAdapter<T>
-
- All Implemented Interfaces:
Serializable,SimpleVersionedSerializer<T>,Versioned
@Internal public class SimpleVersionedSerializerAdapter<T> extends Object implements SimpleVersionedSerializer<T>, Serializable
Adapter forTypeSerializertoSimpleVersionedSerializer. The implementation is naive and should only be used for non-critical paths and tests.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleVersionedSerializerAdapter(TypeSerializer<T> serializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tdeserialize(int version, byte[] serialized)De-serializes the given data (bytes) which was serialized with the scheme of the indicated version.intgetVersion()Gets the version with which this serializer serializes.byte[]serialize(T value)Serializes the given object.
-
-
-
Constructor Detail
-
SimpleVersionedSerializerAdapter
public SimpleVersionedSerializerAdapter(TypeSerializer<T> serializer)
-
-
Method Detail
-
getVersion
public int getVersion()
Description copied from interface:SimpleVersionedSerializerGets the version with which this serializer serializes.- Specified by:
getVersionin interfaceSimpleVersionedSerializer<T>- Specified by:
getVersionin interfaceVersioned- Returns:
- The version of the serialization schema.
-
serialize
public byte[] serialize(T value) throws IOException
Description copied from interface:SimpleVersionedSerializerSerializes the given object. The serialization is assumed to correspond to the current serialization version (as returned bySimpleVersionedSerializer.getVersion().- Specified by:
serializein interfaceSimpleVersionedSerializer<T>- Parameters:
value- The object to serialize.- Returns:
- The serialized data (bytes).
- Throws:
IOException- Thrown, if the serialization fails.
-
deserialize
public T deserialize(int version, byte[] serialized) throws IOException
Description copied from interface:SimpleVersionedSerializerDe-serializes the given data (bytes) which was serialized with the scheme of the indicated version.- Specified by:
deserializein interfaceSimpleVersionedSerializer<T>- Parameters:
version- The version in which the data was serializedserialized- The serialized data- Returns:
- The deserialized object
- Throws:
IOException- Thrown, if the deserialization fails.
-
-