T - the type of the elements written to the sinkpublic class TextSink<T> extends Sink<T>
Sink.SinkWriter<ElemT>| Modifier and Type | Method and Description |
|---|---|
static <V> TextSink<V> |
create(String filenamePrefix,
String shardFormat,
String filenameSuffix,
int shardCount,
boolean appendTrailingNewlines,
String header,
String footer,
Coder<V> coder)
Constructs a new TextSink.
|
static <V> TextSink<WindowedValue<V>> |
createForDirectPipelineRunner(String filenamePrefix,
String shardFormat,
String filenameSuffix,
int shardCount,
boolean appendTrailingNewlines,
String header,
String footer,
Coder<V> coder)
For DirectPipelineRunner only.
|
static <V> TextSink<WindowedValue<V>> |
createForTest(String filename,
boolean appendTrailingNewlines,
String header,
String footer,
Coder<V> coder)
For testing only.
|
Sink.SinkWriter<T> |
writer()
Returns a Writer that allows writing to this Sink.
|
supportsRestartpublic static <V> TextSink<WindowedValue<V>> createForTest(String filename, boolean appendTrailingNewlines, @Nullable String header, @Nullable String footer, Coder<V> coder)
Used by simple tests that write to a single unsharded file.
public static <V> TextSink<WindowedValue<V>> createForDirectPipelineRunner(String filenamePrefix, String shardFormat, String filenameSuffix, int shardCount, boolean appendTrailingNewlines, @Nullable String header, @Nullable String footer, Coder<V> coder)
WindowedValue.ValueOnlyCoder.public static <V> TextSink<V> create(String filenamePrefix, String shardFormat, String filenameSuffix, int shardCount, boolean appendTrailingNewlines, @Nullable String header, @Nullable String footer, Coder<V> coder)
filenamePrefix - the prefix of output filenames.shardFormat - the shard name template to use for output filenames.filenameSuffix - the suffix of output filenames.shardCount - the number of outupt shards to produce.appendTrailingNewlines - true to append newlines to each output line.header - text to place at the beginning of each output file.footer - text to place at the end of each output file.coder - the code used to encode elements for output.public Sink.SinkWriter<T> writer() throws IOException
Sinkwriter in class Sink<T>IOException