Package org.apache.commons.compress.compressors.gzip

# Class GzipCompressorInputStream.Builder

java.lang.Object
org.apache.commons.io.build.AbstractSupplier<GzipCompressorInputStream,GzipCompressorInputStream.Builder>
org.apache.commons.io.build.AbstractOriginSupplier<GzipCompressorInputStream,GzipCompressorInputStream.Builder>
org.apache.commons.io.build.AbstractStreamBuilder<GzipCompressorInputStream,GzipCompressorInputStream.Builder>
org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream.Builder

All Implemented Interfaces:
  `IOSupplier<GzipCompressorInputStream>`

Enclosing class:
  `GzipCompressorInputStream`

public static class GzipCompressorInputStream.Builder extends AbstractStreamBuilder<GzipCompressorInputStream,GzipCompressorInputStream.Builder>
Builds a new `GzipCompressorInputStream`.

For example:

     GzipCompressorInputStream s = GzipCompressorInputStream.builder()
       .setPath(path)
       .setFileNameCharset(StandardCharsets.ISO_8859_1)
       .get();

Since:
  1.28.0
See Also:
  - `get()`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`
  Constructs a new builder of `GzipCompressorInputStream`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `GzipCompressorInputStream`
  `get()`
  Builds a new `GzipCompressorInputStream`.
  `GzipCompressorInputStream.Builder`
  `setDecompressConcatenated(boolean decompressConcatenated)`
  Sets whether we should allow decompressing multiple members.
  `GzipCompressorInputStream.Builder`
  `setFileNameCharset(Charset fileNameCharset)`
  Sets the Charset to use for writing file names and comments, where null maps to `GzipUtils.GZIP_ENCODING`.
  `GzipCompressorInputStream.Builder`
  `setOnMemberEnd(IOConsumer<GzipCompressorInputStream> onMemberEnd)`
  Sets the consumer called when a member trailer is parsed.
  `GzipCompressorInputStream.Builder`
  `setOnMemberStart(IOConsumer<GzipCompressorInputStream> onMemberStart)`
  Sets the consumer called when a member header is parsed.

  ### 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, getUnchecked`

- ## Constructor Details

  - ### Builder

    public Builder()
    Constructs a new builder of `GzipCompressorInputStream`.

- ## Method Details

  - ### get

    public GzipCompressorInputStream get() throws IOException
    Builds a new `GzipCompressorInputStream`.

    You must set input that supports `InputStream`, otherwise, this method throws an exception.

    Returns:
      a new instance.
    Throws:
      `IllegalStateException` - if the `origin` is `null`.
      `UnsupportedOperationException` - if the origin cannot be converted to an `InputStream`.
      `IOException`
    See Also:
      - `AbstractOrigin.getInputStream(java.nio.file.OpenOption...)`

  - ### setDecompressConcatenated

    public GzipCompressorInputStream.Builder setDecompressConcatenated(boolean decompressConcatenated)
    Sets whether we should allow decompressing multiple members.
    Parameters:
      `decompressConcatenated` - whether we should allow decompressing multiple members.
    Returns:
      this instance.

  - ### setFileNameCharset

    public GzipCompressorInputStream.Builder setFileNameCharset(Charset fileNameCharset)
    Sets the Charset to use for writing file names and comments, where null maps to `GzipUtils.GZIP_ENCODING`.

    Setting a value other than `GzipUtils.GZIP_ENCODING` is not compliant with the RFC 1952 GZIP File Format Specification. Use at your own risk of interoperability issues.

    The default value is `GzipUtils.GZIP_ENCODING`.

    Parameters:
      `fileNameCharset` - the Charset to use for writing file names and comments, null maps to `GzipUtils.GZIP_ENCODING`.
    Returns:
      this instance.

  - ### setOnMemberEnd

    public GzipCompressorInputStream.Builder setOnMemberEnd(IOConsumer<GzipCompressorInputStream> onMemberEnd)
    Sets the consumer called when a member trailer is parsed.

    When a member header is parsed, all `GzipParameters` values are initialized except `trailerCrc` and `trailerISize`.

    When a member trailer is parsed, the `GzipParameters` values `trailerCrc` and `trailerISize` are set.

    Parameters:
      `onMemberEnd` - The consumer.
    Returns:
      this instance.
    See Also:
      - `GzipCompressorInputStream.getMetaData()`

  - ### setOnMemberStart

    public GzipCompressorInputStream.Builder setOnMemberStart(IOConsumer<GzipCompressorInputStream> onMemberStart)
    Sets the consumer called when a member header is parsed.

    When a member header is parsed, all `GzipParameters` values are initialized except `trailerCrc` and `trailerISize`.

    When a member trailer is parsed, the `GzipParameters` values `trailerCrc` and `trailerISize` are set.

    Parameters:
      `onMemberStart` - The consumer.
    Returns:
      this instance.
    See Also:
      - `GzipCompressorInputStream.getMetaData()`