org.apache.commons.io.build

## Class AbstractStreamBuilder<T,B extends AbstractStreamBuilder<T,B>>

- 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>

- Type Parameters:
    `T` - the type of instances to build.
    `B` - the type of builder subclass.
  All Implemented Interfaces:
    IOSupplier<T>
  Direct Known Subclasses:
    BOMInputStream.Builder, BufferedFileChannelInputStream.Builder, DeferredFileOutputStream.Builder, FileWriterWithEncoding.Builder, LockableFileWriter.Builder, MemoryMappedFileInputStream.Builder, MessageDigestCalculatingInputStream.Builder, QueueInputStream.Builder, RandomAccessFileInputStream.Builder, ReadAheadInputStream.Builder, ReaderInputStream.Builder, ReversedLinesFileReader.Builder, Tailer.Builder, UncheckedBufferedReader.Builder, UncheckedFilterInputStream.Builder, UncheckedFilterOutputStream.Builder, UncheckedFilterReader.Builder, UncheckedFilterWriter.Builder, UnsynchronizedBufferedInputStream.Builder, UnsynchronizedByteArrayInputStream.Builder, UnsynchronizedByteArrayOutputStream.Builder, UnsynchronizedFilterInputStream.Builder, WriterOutputStream.Builder, XmlStreamReader.Builder, XmlStreamWriter.Builder

      public abstract class AbstractStreamBuilder<T,B extends AbstractStreamBuilder<T,B>>
      extends AbstractOriginSupplier<T,B>

  Abstracts building a typed instance of `T`.
  Since:
    2.12.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractStreamBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `getBufferSize()` Gets the buffer size, defaults to `IOUtils.DEFAULT_BUFFER_SIZE` ().
    `protected int` | `getBufferSizeDefault()` Gets the buffer size default, defaults to `IOUtils.DEFAULT_BUFFER_SIZE` ().
    `protected Charset` | `getCharset()` Gets the Charset, defaults to `Charset.defaultCharset()`.
    `protected Charset` | `getCharsetDefault()` Gets the Charset default, defaults to `Charset.defaultCharset()`.
    `B` | `setBufferSize(int bufferSize)` Sets the buffer size.
    `B` | `setBufferSize(Integer bufferSize)` Sets the buffer size.
    `protected B` | `setBufferSizeDefault(int bufferSizeDefault)` Sets the buffer size for subclasses to initialize.
    `B` | `setCharset(Charset charset)` Sets the Charset.
    `B` | `setCharset(String charset)` Sets the Charset.
    `protected B` | `setCharsetDefault(Charset defaultCharset)` Sets the Charset default for subclasses to initialize.

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

      `checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, 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`

- - ### Constructor Detail

    - #### AbstractStreamBuilder

          public AbstractStreamBuilder()

  - ### Method Detail

    - #### getBufferSize

          protected int getBufferSize()

      Gets the buffer size, defaults to `IOUtils.DEFAULT_BUFFER_SIZE` ().
      Returns:
        the buffer size, defaults to `IOUtils.DEFAULT_BUFFER_SIZE` ().

    - #### getBufferSizeDefault

          protected int getBufferSizeDefault()

      Gets the buffer size default, defaults to `IOUtils.DEFAULT_BUFFER_SIZE` ().
      Returns:
        the buffer size default, defaults to `IOUtils.DEFAULT_BUFFER_SIZE` ().

    - #### getCharset

          protected Charset getCharset()

      Gets the Charset, defaults to `Charset.defaultCharset()`.
      Returns:
        the Charset, defaults to `Charset.defaultCharset()`.

    - #### getCharsetDefault

          protected Charset getCharsetDefault()

      Gets the Charset default, defaults to `Charset.defaultCharset()`.
      Returns:
        the Charset default, defaults to `Charset.defaultCharset()`.

    - #### setBufferSize

          public B setBufferSize(int bufferSize)

      Sets the buffer size.

      Subclasses may ignore this setting.

      Parameters:
        `bufferSize` - the buffer size.
      Returns:
        this.

    - #### setBufferSize

          public B setBufferSize(Integer bufferSize)

      Sets the buffer size.

      Subclasses may ignore this setting.

      Parameters:
        `bufferSize` - the buffer size, null resets to the default.
      Returns:
        this.

    - #### setBufferSizeDefault

          protected B setBufferSizeDefault(int bufferSizeDefault)

      Sets the buffer size for subclasses to initialize.

      Subclasses may ignore this setting.

      Parameters:
        `bufferSizeDefault` - the buffer size, null resets to the default.
      Returns:
        this.

    - #### setCharset

          public B setCharset(Charset charset)

      Sets the Charset.

      Subclasses may ignore this setting.

      Parameters:
        `charset` - the Charset, null resets to the default.
      Returns:
        this.

    - #### setCharset

          public B setCharset(String charset)

      Sets the Charset.

      Subclasses may ignore this setting.

      Parameters:
        `charset` - the Charset name, null resets to the default.
      Returns:
        this.

    - #### setCharsetDefault

          protected B setCharsetDefault(Charset defaultCharset)

      Sets the Charset default for subclasses to initialize.

      Subclasses may ignore this setting.

      Parameters:
        `defaultCharset` - the Charset name, null resets to the default.
      Returns:
        this.

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.