Class PublisherBytesSupplier

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendContent​(byte[] data, boolean lastChunk)
      Appends content to the BytesSupplier.
      byte[] getAsBytes()
      Returns the byte[] presentation of the object.
      void subscribe​(java.util.function.Consumer<byte[]> subscriber)
      Adds the subscriber to the BytesSupplier to get notified about additional data.
      java.nio.ByteBuffer toByteBuffer()
      Returns the ByteBuffer presentation of the object.
      void waitToRead()
      Waits until completed before passing thread (BLOCKS THREAD!).
      • Methods inherited from class java.lang.Object

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

      • appendContent

        public void appendContent​(byte[] data,
                                  boolean lastChunk)
        Appends content to the BytesSupplier.
        Parameters:
        data - bytes to append
        lastChunk - true if this is the last chunk
      • subscribe

        public void subscribe​(java.util.function.Consumer<byte[]> subscriber)
        Adds the subscriber to the BytesSupplier to get notified about additional data.
        Parameters:
        subscriber - a consumer function that will receive bytes when new daata is added and null when completed
      • waitToRead

        public void waitToRead()
        Waits until completed before passing thread (BLOCKS THREAD!).
      • getAsBytes

        public byte[] getAsBytes()
        Returns the byte[] presentation of the object.
        Specified by:
        getAsBytes in interface BytesSupplier
        Returns:
        the byte[] presentation of the object
      • toByteBuffer

        public java.nio.ByteBuffer toByteBuffer()
        Returns the ByteBuffer presentation of the object.
        Specified by:
        toByteBuffer in interface BytesSupplier
        Returns:
        the ByteBuffer presentation of the object