T - The type of the elements that are being written by the sink.public class StringWriter<T> extends StreamWriterBase<T>
Writer that uses toString() on the input elements and writes them to
the output bucket file separated by newline.| 限定符 | 构造器和说明 |
|---|---|
|
StringWriter()
Creates a new
StringWriter that uses "UTF-8" charset to convert
strings to bytes. |
|
StringWriter(String charsetName)
Creates a new
StringWriter that uses the given charset to convert
strings to bytes. |
protected |
StringWriter(StringWriter<T> other) |
| 限定符和类型 | 方法和说明 |
|---|---|
StringWriter<T> |
duplicate()
Duplicates the
Writer. |
void |
open(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Initializes the
Writer for a newly opened bucket file. |
void |
write(T element)
Writes one element to the bucket file.
|
close, flush, getPos, getStream, isSyncOnFlush, setSyncOnFlushpublic StringWriter()
StringWriter that uses "UTF-8" charset to convert
strings to bytes.public StringWriter(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)protected StringWriter(StringWriter<T> other)
public void open(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
throws IOException
WriterWriter for a newly opened bucket file.
Any internal per-bucket initialization should be performed here.open 在接口中 Writer<T>open 在类中 StreamWriterBase<T>fs - The FileSystem containing the newly opened file.path - The Path of the newly opened file.IOExceptionpublic void write(T element) throws IOException
WriterIOExceptionpublic StringWriter<T> duplicate()
WriterWriter. This is used to get one Writer for each
parallel instance of the sink.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.