Class DataStreams.ElementDelimitedOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Enclosing class:
    DataStreams

    public static final class DataStreams.ElementDelimitedOutputStream
    extends java.io.OutputStream
    An adapter which wraps an DataStreams.OutputChunkConsumer as an OutputStream.

    Note that this adapter follows the Beam Fn API specification for forcing values that encode producing zero bytes to produce exactly one byte.

    Note that users must invoke delimitElement() at each element boundary.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void delimitElement()  
      void write​(byte[] b, int offset, int length)  
      void write​(int i)  
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

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

      • ElementDelimitedOutputStream

        public ElementDelimitedOutputStream​(DataStreams.OutputChunkConsumer<org.apache.beam.vendor.grpc.v1p48p1.com.google.protobuf.ByteString> consumer,
                                            int maximumChunkSize)
    • Method Detail

      • delimitElement

        public void delimitElement()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public void write​(int i)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int offset,
                          int length)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException