Class 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 simple Encoder that uses toString() on the input elements and writes them to the output bucket file separated by newline.
    See Also:
    Serialized Form
    • Constructor Detail

      • SimpleStringEncoder

        public SimpleStringEncoder()
        Creates a new StringWriter that uses "UTF-8" charset to convert strings to bytes.
      • SimpleStringEncoder

        public SimpleStringEncoder​(String charsetName)
        Creates a new StringWriter that uses the given charset to convert strings to bytes.
        Parameters:
        charsetName - Name of the charset to be used, must be valid input for Charset.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 interface Encoder<IN>
        Parameters:
        element - the element to be written.
        stream - the stream to write the element to.
        Throws:
        IOException