Class SimpleStringSchema
- java.lang.Object
-
- org.apache.flink.api.common.serialization.SimpleStringSchema
-
- All Implemented Interfaces:
Serializable,DeserializationSchema<String>,SerializationSchema<String>,ResultTypeQueryable<String>
@PublicEvolving public class SimpleStringSchema extends Object implements DeserializationSchema<String>, SerializationSchema<String>
Very simple serialization schema for strings.By default, the serializer uses "UTF-8" for string/byte conversion.
- 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 SimpleStringSchema()Creates a new SimpleStringSchema that uses "UTF-8" as the encoding.SimpleStringSchema(Charset charset)Creates a new SimpleStringSchema that uses the given charset to convert between strings and bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdeserialize(byte[] message)Deserializes the byte message.CharsetgetCharset()Gets the charset used by this schema for serialization.TypeInformation<String>getProducedType()Gets the data type (as aTypeInformation) produced by this function or input format.booleanisEndOfStream(String nextElement)Method to decide whether the element signals the end of the stream.byte[]serialize(String 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
-
SimpleStringSchema
public SimpleStringSchema()
Creates a new SimpleStringSchema that uses "UTF-8" as the encoding.
-
SimpleStringSchema
public SimpleStringSchema(Charset charset)
Creates a new SimpleStringSchema that uses the given charset to convert between strings and bytes.- Parameters:
charset- The charset to use to convert between strings and bytes.
-
-
Method Detail
-
getCharset
public Charset getCharset()
Gets the charset used by this schema for serialization.- Returns:
- The charset used by this schema for serialization.
-
deserialize
public String deserialize(byte[] message)
Description copied from interface:DeserializationSchemaDeserializes the byte message.- Specified by:
deserializein interfaceDeserializationSchema<String>- 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(String nextElement)
Description copied from interface:DeserializationSchemaMethod to decide whether the element signals the end of the stream. If true is returned the element won't be emitted.- Specified by:
isEndOfStreamin interfaceDeserializationSchema<String>- Parameters:
nextElement- The element to test for the end-of-stream signal.- Returns:
- True, if the element signals end of stream, false otherwise.
-
serialize
public byte[] serialize(String element)
Description copied from interface:SerializationSchemaSerializes the incoming element to a specified type.- Specified by:
serializein interfaceSerializationSchema<String>- Parameters:
element- The incoming element to be serialized- Returns:
- The serialized element.
-
getProducedType
public TypeInformation<String> getProducedType()
Description copied from interface:ResultTypeQueryableGets the data type (as aTypeInformation) produced by this function or input format.- Specified by:
getProducedTypein interfaceResultTypeQueryable<String>- Returns:
- The data type produced by this function or input format.
-
-