@Internal public class TypeSerializerSerializationUtil extends Object
TypeSerializer
and TypeSerializerConfigSnapshot
.Modifier and Type | Class and Description |
---|---|
static class |
TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<T>
Utility serialization proxy for a
TypeSerializer . |
Constructor and Description |
---|
TypeSerializerSerializationUtil() |
public static <T> void writeSerializer(DataOutputView out, TypeSerializer<T> serializer) throws IOException
TypeSerializer
to the provided data output view.
It is written with a format that can be later read again using
tryReadSerializer(DataInputView, ClassLoader, boolean)
.
T
- Data type of the serializer.out
- the data output view.serializer
- the serializer to write.IOException
public static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
TypeSerializer
that was previously
written using writeSerializer(DataOutputView, TypeSerializer)
.
If deserialization fails for any reason (corrupted serializer bytes, serializer class
no longer in classpath, serializer class no longer valid, etc.), an IOException
is thrown.
T
- Data type of the serializer.in
- the data input view.userCodeClassLoader
- the user code class loader to use.IOException
public static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader, boolean useDummyPlaceholder) throws IOException
TypeSerializer
that was previously
written using writeSerializer(DataOutputView, TypeSerializer)
.
If deserialization fails due to any exception, users can opt to use a dummy
UnloadableDummyTypeSerializer
to hold the serializer bytes, otherwise an IOException
is thrown.
T
- Data type of the serializer.in
- the data input view.userCodeClassLoader
- the user code class loader to use.useDummyPlaceholder
- whether or not to use a dummy UnloadableDummyTypeSerializer
to hold the
serializer bytes in the case of a ClassNotFoundException
or
InvalidClassException
.IOException
public static void writeSerializersAndConfigsWithResilience(DataOutputView out, List<Tuple2<TypeSerializer<?>,TypeSerializerConfigSnapshot>> serializersAndConfigs) throws IOException
readSerializersAndConfigsWithResilience(DataInputView, ClassLoader)
, if
deserialization of the serializer fails, its configuration snapshot will remain intact.
Specifically, all written serializers and their config snapshots are indexed by their offset positions within the serialized bytes. The serialization format is as follows:
out
- the data output view.serializersAndConfigs
- serializer and configuration snapshot pairsIOException
public static List<Tuple2<TypeSerializer<?>,TypeSerializerConfigSnapshot>> readSerializersAndConfigsWithResilience(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
writeSerializersAndConfigsWithResilience(DataOutputView, List)
.
If deserialization for serializers fails due to any exception, users can opt to use a dummy
UnloadableDummyTypeSerializer
to hold the serializer bytes
in
- the data input view.userCodeClassLoader
- the user code class loader to use.IOException
public static void writeSerializerConfigSnapshot(DataOutputView out, TypeSerializerConfigSnapshot serializerConfigSnapshot) throws IOException
TypeSerializerConfigSnapshot
to the provided data output view.
It is written with a format that can be later read again using
readSerializerConfigSnapshot(DataInputView, ClassLoader)
.
out
- the data output viewserializerConfigSnapshot
- the serializer configuration snapshot to writeIOException
public static TypeSerializerConfigSnapshot readSerializerConfigSnapshot(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
TypeSerializerConfigSnapshot
that was previously
written using writeSerializerConfigSnapshot(DataOutputView, TypeSerializerConfigSnapshot)
.in
- the data input viewuserCodeClassLoader
- the user code class loader to useIOException
public static void writeSerializerConfigSnapshots(DataOutputView out, TypeSerializerConfigSnapshot... serializerConfigSnapshots) throws IOException
TypeSerializerConfigSnapshot
s to the provided data output view.
It is written with a format that can be later read again using
readSerializerConfigSnapshots(DataInputView, ClassLoader)
.
out
- the data output viewserializerConfigSnapshots
- the serializer configuration snapshots to writeIOException
public static TypeSerializerConfigSnapshot[] readSerializerConfigSnapshots(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
TypeSerializerConfigSnapshot
s that was previously
written using writeSerializerConfigSnapshot(DataOutputView, TypeSerializerConfigSnapshot)
.in
- the data input viewuserCodeClassLoader
- the user code class loader to useIOException
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.