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

Type Parameters:
T - The subclass.
All Implemented Interfaces:
IOSupplier<BoundedInputStream>
Direct Known Subclasses:
BoundedInputStream.Builder
Enclosing class:
BoundedInputStream

abstract static class BoundedInputStream.AbstractBuilder<T extends BoundedInputStream.AbstractBuilder<T>> extends AbstractStreamBuilder<BoundedInputStream,T>
For subclassing builders from BoundedInputStream subclassses.
  • Field Details

    • count

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

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

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

    • AbstractBuilder

      AbstractBuilder()
  • Method Details

    • getCount

      long getCount()
    • getMaxCount

      long getMaxCount()
    • 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.
    • 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.
      Returns:
      this.
    • setPropagateClose

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

      Default is true.

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