Class BoundedInputStream.AbstractBuilder<T extends BoundedInputStream.AbstractBuilder<T>>

    • Field Detail

      • count

        private long count
        The current count of bytes counted.
      • maxCount

        private long maxCount
        The max count of bytes to read.
      • onMaxCount

        private IOBiConsumer<java.lang.Long,​java.lang.Long> onMaxCount
      • propagateClose

        private boolean propagateClose
        Flag if ProxyInputStream.close() should be propagated, true by default.
    • Constructor Detail

      • AbstractBuilder

        AbstractBuilder()
    • Method Detail

      • getCount

        long getCount()
      • getMaxCount

        long getMaxCount()
      • getOnMaxCount

        IOBiConsumer<java.lang.Long,​java.lang.Long> getOnMaxCount()
      • isPropagateClose

        boolean isPropagateClose()
      • setCount

        public T setCount​(long count)
        Sets the current number of bytes counted.

        Useful when building from another stream to carry forward a read count.

        Default is 0, negative means 0.

        Parameters:
        count - The current number of bytes counted.
        Returns:
        this instance.
      • setMaxCount

        public T setMaxCount​(long maxCount)
        Sets the maximum number of bytes to return.

        Default is -1, negative means unbound.

        Parameters:
        maxCount - The maximum number of bytes to return, negative means unbound.
        Returns:
        this instance.
      • setPropagateClose

        public T setPropagateClose​(boolean propagateClose)
        Sets whether the ProxyInputStream.close() method should propagate to the underling InputStream.

        Default is true.

        Parameters:
        propagateClose - true if calling ProxyInputStream.close() propagates to the close() method of the underlying stream or false if it does not.
        Returns:
        this instance.