Class GzipCompressorInputStream.Builder
- 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<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 newGzipCompressorInputStream.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 ofGzipCompressorInputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GzipCompressorInputStreamget()Builds a newGzipCompressorInputStream.GzipCompressorInputStream.BuildersetDecompressConcatenated(boolean decompressConcatenated)Sets whether we should allow decompressing multiple members.GzipCompressorInputStream.BuildersetFileNameCharset(java.nio.charset.Charset fileNameCharset)Sets the Charset to use for writing file names and comments, where null maps toGzipUtils.GZIP_ENCODING.GzipCompressorInputStream.BuildersetOnMemberEnd(IOConsumer<GzipCompressorInputStream> onMemberEnd)Sets the consumer called when a member trailer is parsed.GzipCompressorInputStream.BuildersetOnMemberStart(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, setBufferSizeMax, setCharset, setCharset, setOpenOptions
-
Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriter
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, getUnchecked
-
-
-
-
Constructor Detail
-
Builder
public Builder()
Constructs a new builder ofGzipCompressorInputStream.
-
-
Method Detail
-
get
public GzipCompressorInputStream get() throws java.io.IOException
Builds a newGzipCompressorInputStream.You must set input that supports
InputStream, otherwise, this method throws an exception.- Returns:
- a new instance.
- Throws:
java.lang.IllegalStateException- if theoriginisnull.java.lang.UnsupportedOperationException- if the origin cannot be converted to anInputStream.java.io.IOException- if an I/O error occurs.- 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(java.nio.charset.Charset fileNameCharset)
Sets the Charset to use for writing file names and comments, where null maps toGzipUtils.GZIP_ENCODING.Setting a value other than
GzipUtils.GZIP_ENCODINGis 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 toGzipUtils.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
GzipParametersvalues are initialized excepttrailerCrcandtrailerISize.When a member trailer is parsed, the
GzipParametersvaluestrailerCrcandtrailerISizeare 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
GzipParametersvalues are initialized excepttrailerCrcandtrailerISize.When a member trailer is parsed, the
GzipParametersvaluestrailerCrcandtrailerISizeare set.- Parameters:
onMemberStart- The consumer.- Returns:
- this instance.
- See Also:
GzipCompressorInputStream.getMetaData()
-
-