Class SimpleStringEncoder<IN>
- java.lang.Object
-
- org.apache.flink.api.common.serialization.SimpleStringEncoder<IN>
-
- Type Parameters:
IN
- The type of the elements that are being written by the sink.
- All Implemented Interfaces:
Serializable
,Encoder<IN>
@PublicEvolving public class SimpleStringEncoder<IN> extends Object implements Encoder<IN>
A simpleEncoder
that usestoString()
on the input elements and writes them to the output bucket file separated by newline.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleStringEncoder()
Creates a newStringWriter
that uses"UTF-8"
charset to convert strings to bytes.SimpleStringEncoder(String charsetName)
Creates a newStringWriter
that uses the given charset to convert strings to bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encode(IN element, OutputStream stream)
Writes one element to the bucket file.
-
-
-
Constructor Detail
-
SimpleStringEncoder
public SimpleStringEncoder()
Creates a newStringWriter
that uses"UTF-8"
charset to convert strings to bytes.
-
SimpleStringEncoder
public SimpleStringEncoder(String charsetName)
Creates a newStringWriter
that uses the given charset to convert strings to bytes.- Parameters:
charsetName
- Name of the charset to be used, must be valid input forCharset.forName(charsetName)
-
-
Method Detail
-
encode
public void encode(IN element, OutputStream stream) throws IOException
Description copied from interface:Encoder
Writes one element to the bucket file.- Specified by:
encode
in interfaceEncoder<IN>
- Parameters:
element
- the element to be written.stream
- the stream to write the element to.- Throws:
IOException
-
-