Class TypeInformationSerializationSchema<T>
- java.lang.Object
-
- org.apache.flink.api.common.serialization.TypeInformationSerializationSchema<T>
-
- Type Parameters:
T
- The type to be serialized.
- All Implemented Interfaces:
Serializable
,DeserializationSchema<T>
,SerializationSchema<T>
,ResultTypeQueryable<T>
@Public public class TypeInformationSerializationSchema<T> extends Object implements DeserializationSchema<T>, SerializationSchema<T>
A serialization and deserialization schema that uses Flink's serialization stack to transform typed from and to byte arrays.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
DeserializationSchema.InitializationContext
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.SerializationSchema
SerializationSchema.InitializationContext
-
-
Constructor Summary
Constructors Constructor Description TypeInformationSerializationSchema(TypeInformation<T> typeInfo, ExecutionConfig ec)
Creates a new de-/serialization schema for the given type.TypeInformationSerializationSchema(TypeInformation<T> typeInfo, TypeSerializer<T> serializer)
Creates a new de-/serialization schema for the given type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deserialize(byte[] message)
Deserializes the byte message.TypeInformation<T>
getProducedType()
Gets the data type (as aTypeInformation
) produced by this function or input format.boolean
isEndOfStream(T nextElement)
This schema never considers an element to signal end-of-stream, so this method returns always false.byte[]
serialize(T element)
Serializes the incoming element to a specified type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
deserialize, open
-
Methods inherited from interface org.apache.flink.api.common.serialization.SerializationSchema
open
-
-
-
-
Constructor Detail
-
TypeInformationSerializationSchema
public TypeInformationSerializationSchema(TypeInformation<T> typeInfo, ExecutionConfig ec)
Creates a new de-/serialization schema for the given type.- Parameters:
typeInfo
- The type information for the type de-/serialized by this schema.ec
- The execution config, which is used to parametrize the type serializers.
-
TypeInformationSerializationSchema
public TypeInformationSerializationSchema(TypeInformation<T> typeInfo, TypeSerializer<T> serializer)
Creates a new de-/serialization schema for the given type.- Parameters:
typeInfo
- The type information for the type de-/serialized by this schema.serializer
- The serializer to use for de-/serialization.
-
-
Method Detail
-
deserialize
public T deserialize(byte[] message)
Description copied from interface:DeserializationSchema
Deserializes the byte message.- Specified by:
deserialize
in interfaceDeserializationSchema<T>
- Parameters:
message
- The message, as a byte array.- Returns:
- The deserialized message as an object (null if the message cannot be deserialized).
-
isEndOfStream
public boolean isEndOfStream(T nextElement)
This schema never considers an element to signal end-of-stream, so this method returns always false.- Specified by:
isEndOfStream
in interfaceDeserializationSchema<T>
- Parameters:
nextElement
- The element to test for the end-of-stream signal.- Returns:
- Returns false.
-
serialize
public byte[] serialize(T element)
Description copied from interface:SerializationSchema
Serializes the incoming element to a specified type.- Specified by:
serialize
in interfaceSerializationSchema<T>
- Parameters:
element
- The incoming element to be serialized- Returns:
- The serialized element.
-
getProducedType
public TypeInformation<T> getProducedType()
Description copied from interface:ResultTypeQueryable
Gets the data type (as aTypeInformation
) produced by this function or input format.- Specified by:
getProducedType
in interfaceResultTypeQueryable<T>
- Returns:
- The data type produced by this function or input format.
-
-