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:
org.apache.commons.io.function.IOSupplier<GzipCompressorInputStream>
- Enclosing class:
- GzipCompressorInputStream
public static class GzipCompressorInputStream.Builder extends org.apache.commons.io.build.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(org.apache.commons.io.function.IOConsumer<GzipCompressorInputStream> onMemberEnd)Sets the consumer called when a member trailer is parsed.GzipCompressorInputStream.BuildersetOnMemberStart(org.apache.commons.io.function.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, getByteArray, getChannel, 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, newChannelOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setChannel, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriter
-
-
-
-
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- 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(org.apache.commons.io.function.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(org.apache.commons.io.function.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()
-
-