Class AvroIO.Sink<ElementT>

    • Constructor Summary

      Constructors 
      Constructor Description
      Sink()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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​(org.apache.avro.file.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Sink

        public Sink()
    • 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 given CodecFactory for each generated file. By default, CodecFactory.snappyCodec().
      • open

        public void open​(java.nio.channels.WritableByteChannel channel)
                  throws java.io.IOException
        Description copied from interface: FileIO.Sink
        Initializes writing to the given channel. Will be invoked once on a given FileIO.Sink instance.
        Specified by:
        open in interface FileIO.Sink<ElementT>
        Throws:
        java.io.IOException
      • write

        public void write​(ElementT element)
                   throws java.io.IOException
        Description copied from interface: FileIO.Sink
        Appends a single element to the file. May be invoked zero or more times.
        Specified by:
        write in interface FileIO.Sink<ElementT>
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Description copied from interface: FileIO.Sink
        Flushes the buffered state (if any) before the channel is closed. Does not need to close the channel. Will be invoked once.
        Specified by:
        flush in interface FileIO.Sink<ElementT>
        Throws:
        java.io.IOException