IN - The type of the elements that are being written by the sink.@PublicEvolving public class SimpleStringEncoder<IN> extends Object implements Encoder<IN>
Encoder that uses toString() on the input elements and
writes them to the output bucket file separated by newline.| Constructor and Description |
|---|
SimpleStringEncoder()
Creates a new
StringWriter that uses "UTF-8" charset to convert
strings to bytes. |
SimpleStringEncoder(String charsetName)
Creates a new
StringWriter that uses the given charset to convert
strings to bytes. |
| Modifier and Type | Method and Description |
|---|---|
void |
encode(IN element,
OutputStream stream)
Writes one element to the bucket file.
|
public SimpleStringEncoder()
StringWriter that uses "UTF-8" charset to convert
strings to bytes.public SimpleStringEncoder(String charsetName)
StringWriter that uses the given charset to convert
strings to bytes.charsetName - Name of the charset to be used, must be valid input for Charset.forName(charsetName)public void encode(IN element, OutputStream stream) throws IOException
Encoderencode in interface Encoder<IN>element - the element to be written.stream - the stream to write the element to.IOExceptionCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.