Class AvroIO.Sink<ElementT>
- java.lang.Object
-
- org.apache.beam.sdk.extensions.avro.io.AvroIO.Sink<ElementT>
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.beam.sdk.io.FileIO.Sink<ElementT>
- Enclosing class:
- AvroIO
public abstract static class AvroIO.Sink<ElementT> extends java.lang.Object implements org.apache.beam.sdk.io.FileIO.Sink<ElementT>Implementation ofAvroIO.sink(java.lang.Class<ElementT>)andAvroIO.sinkViaGenericRecords(org.apache.avro.Schema, org.apache.beam.sdk.extensions.avro.io.AvroIO.RecordFormatter<ElementT>).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Sink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()voidopen(java.nio.channels.WritableByteChannel channel)AvroIO.Sink<ElementT>withCodec(org.apache.avro.file.CodecFactory codec)Specifies to use the givenCodecFactoryfor each generated file.AvroIO.Sink<ElementT>withDatumWriterFactory(AvroSink.DatumWriterFactory<ElementT> datumWriterFactory)Sets a customAvroSource.DatumReaderFactoryfor writing.AvroIO.Sink<ElementT>withMetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)Specifies to put the given metadata into each generated file.voidwrite(ElementT element)
-
-
-
Method Detail
-
withMetadata
public AvroIO.Sink<ElementT> withMetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
Specifies to put the given metadata into each generated file. By default, empty.
-
withCodec
public AvroIO.Sink<ElementT> withCodec(org.apache.avro.file.CodecFactory codec)
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
public void open(java.nio.channels.WritableByteChannel channel) throws java.io.IOException- Specified by:
openin interfaceorg.apache.beam.sdk.io.FileIO.Sink<ElementT>- Throws:
java.io.IOException
-
write
public void write(ElementT element) throws java.io.IOException
- Specified by:
writein interfaceorg.apache.beam.sdk.io.FileIO.Sink<ElementT>- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfaceorg.apache.beam.sdk.io.FileIO.Sink<ElementT>- Throws:
java.io.IOException
-
-