org.apache.commons.io.input

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

- java.lang.Object
- - org.apache.commons.io.build.AbstractSupplier<T,B>
  - - org.apache.commons.io.build.AbstractOriginSupplier<T,B>
    - - org.apache.commons.io.build.AbstractStreamBuilder<T,B>
      - - org.apache.commons.io.input.ProxyInputStream.AbstractBuilder<BoundedInputStream,T>
        - - org.apache.commons.io.input.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 ProxyInputStream.AbstractBuilder<BoundedInputStream,T>

  For subclassing builders from `BoundedInputStream` subclassses.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) long` | `getCount()`
    `(package private) long` | `getMaxCount()`
    `(package private) IOBiConsumer<Long,Long>` | `getOnMaxCount()`
    `(package private) boolean` | `isPropagateClose()`
    `T` | `setCount(long count)` Sets the current number of bytes counted.
    `T` | `setMaxCount(long maxCount)` Sets the maximum number of bytes to return.
    `T` | `setOnMaxCount(IOBiConsumer<Long,Long> onMaxCount)` Sets the default `BoundedInputStream.onMaxLength(long, long)` behavior, `null` resets to a NOOP.
    `T` | `setPropagateClose(boolean propagateClose)` Sets whether the `ProxyInputStream.close()` method should propagate to the underling `InputStream`.

    - ### Methods inherited from class org.apache.commons.io.input.ProxyInputStream.AbstractBuilder

      `getAfterRead, setAfterRead`

    - ### Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder

      `getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptions`

    - ### Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier

      `checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriter`

    - ### Methods inherited from class org.apache.commons.io.build.AbstractSupplier

      `asThis`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.commons.io.function.IOSupplier

      `asSupplier, get, getUnchecked`

- - ### Constructor Detail

    - #### AbstractBuilder

          AbstractBuilder()

  - ### Method Detail

    - #### getCount

          long getCount()

    - #### getMaxCount

          long getMaxCount()

    - #### getOnMaxCount

          IOBiConsumer<Long,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 `IOUtils.EOF`, negative means unbound.

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

    - #### setOnMaxCount

          public T setOnMaxCount(IOBiConsumer<Long,Long> onMaxCount)

      Sets the default `BoundedInputStream.onMaxLength(long, long)` behavior, `null` resets to a NOOP.

      The first Long is the max count of bytes to read. The second Long is the count of bytes read.

      This does not override a `BoundedInputStream` subclass' implementation of the `BoundedInputStream.onMaxLength(long, long)` method.

      Parameters:
        `onMaxCount` - the `ProxyInputStream.afterRead(int)` behavior.
      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.