Class InputStreamValve

    • Method Detail

      • byteBufferStringCollector

        public static Collector<ByteBuffer,​ByteArrayOutputStream,​String> byteBufferStringCollector​(Charset charset)
        A collector of ByteBuffer instances into a String of the provided charset.
        Parameters:
        charset - the desired charset of the returned string
        Returns:
        a string representation of the collected byte buffers
      • byteBufferByteArrayCollector

        public static Collector<ByteBuffer,​ByteArrayOutputStream,​byte[]> byteBufferByteArrayCollector()
        A collector of ByteBuffer instances into a single byte array.
        Returns:
        a single byte array from the collected byte buffers
      • tryProcess

        protected void tryProcess()
        Implements item handling / processing. Implementation can use canProcess() and canContinueProcessing() method to ensure, that processing is done by a single thread at a time.
      • canProcess

        protected boolean canProcess()
        Implementation of tryProcess() method should call this to reserve initial handle processing (if possible). The same method should call canContinueProcessing() before every iteration to be sure, that handle processing should continue.
        Returns:
        true only if method can process (handle) item
      • canContinueProcessing

        protected boolean canContinueProcessing()
        Implementation of tryProcess() which initially was accepted by canProcess() should call this method before every iteration to be sure, that processing can continue (is not paused).
        Returns:
        true only if method can continue with handle processing
      • paused

        protected boolean paused()
      • releaseProcessing

        protected void releaseProcessing()
      • handleError

        protected void handleError​(Throwable thr)
      • getOnComplete

        protected Runnable getOnComplete()