Class AvroIO.Sink<ElementT>
java.lang.Object
org.apache.beam.sdk.extensions.avro.io.AvroIO.Sink<ElementT>
- All Implemented Interfaces:
Serializable,FileIO.Sink<ElementT>
- Enclosing class:
AvroIO
Implementation of
AvroIO.sink(java.lang.Class<ElementT>) and AvroIO.sinkViaGenericRecords(org.apache.avro.Schema, org.apache.beam.sdk.extensions.avro.io.AvroIO.RecordFormatter<ElementT>).- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Flushes the buffered state (if any) before the channel is closed.voidopen(WritableByteChannel channel) Initializes writing to the given channel.withCodec(CodecFactory codec) Specifies to use the givenCodecFactoryfor each generated file.withDatumWriterFactory(AvroSink.DatumWriterFactory<ElementT> datumWriterFactory) Sets a customAvroSource.DatumReaderFactoryfor writing.withMetadata(Map<String, Object> metadata) Specifies to put the given metadata into each generated file.voidAppends a single element to the file.
-
Constructor Details
-
Sink
public Sink()
-
-
Method Details
-
withMetadata
Specifies to put the given metadata into each generated file. By default, empty. -
withCodec
Specifies to use the givenCodecFactoryfor each generated file. By default,CodecFactory.snappyCodec(). -
withDatumWriterFactory
public AvroIO.Sink<ElementT> withDatumWriterFactory(AvroSink.DatumWriterFactory<ElementT> datumWriterFactory) Sets a customAvroSource.DatumReaderFactoryfor writing. -
open
Description copied from interface:FileIO.SinkInitializes writing to the given channel. Will be invoked once on a givenFileIO.Sinkinstance.- Specified by:
openin interfaceFileIO.Sink<ElementT>- Throws:
IOException
-
write
Description copied from interface:FileIO.SinkAppends a single element to the file. May be invoked zero or more times.- Specified by:
writein interfaceFileIO.Sink<ElementT>- Throws:
IOException
-
flush
Description copied from interface:FileIO.SinkFlushes the buffered state (if any) before the channel is closed. Does not need to close the channel. Will be invoked once.- Specified by:
flushin interfaceFileIO.Sink<ElementT>- Throws:
IOException
-