public abstract static class AvroIO.Sink<ElementT> extends java.lang.Object implements FileIO.Sink<ElementT>
AvroIO.sink(java.lang.Class<ElementT>)
and AvroIO.sinkViaGenericRecords(org.apache.avro.Schema, org.apache.beam.sdk.io.AvroIO.RecordFormatter<ElementT>)
.Constructor and Description |
---|
Sink() |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flushes the buffered state (if any) before the channel is closed.
|
void |
open(java.nio.channels.WritableByteChannel channel)
Initializes writing to the given channel.
|
AvroIO.Sink<ElementT> |
withCodec(CodecFactory codec)
Specifies to use the given
CodecFactory for each generated file. |
AvroIO.Sink<ElementT> |
withMetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
Specifies to put the given metadata into each generated file.
|
void |
write(ElementT element)
Appends a single element to the file.
|
public AvroIO.Sink<ElementT> withMetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
public AvroIO.Sink<ElementT> withCodec(CodecFactory codec)
CodecFactory
for each generated file. By default, CodecFactory.snappyCodec()
.public void open(java.nio.channels.WritableByteChannel channel) throws java.io.IOException
FileIO.Sink
FileIO.Sink
instance.open
in interface FileIO.Sink<ElementT>
java.io.IOException
public void write(ElementT element) throws java.io.IOException
FileIO.Sink
write
in interface FileIO.Sink<ElementT>
java.io.IOException
public void flush() throws java.io.IOException
FileIO.Sink
flush
in interface FileIO.Sink<ElementT>
java.io.IOException