- Since:
- 1.7
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate Stringprivate intprivate intprivate ExtraFieldprivate Stringprivate Charsetprivate InstantThe most recent modification time (MTIME) of the original file being compressed.private GzipParameters.OSprivate static final int13: Acorn RISCOS.private static final int1: Amiga.private static final int5: Atari TOS.private static final int9: CP/M.private static final int0: FAT.private static final int6: HPFS filesystem (OS/2, NT).private static final int7: Macintosh.private static final int11: NTFS filesystem (NT).private static final int12: QDOS.private static final int10: TOPS-20.private static final int3: Unix.private static final int255: unknown.private static final int4: VM/CMS.private static final int2: VMS (or OpenVMS).private static final int8: Z-System. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets size of the buffer used to retrieve compressed data.Gets an arbitrary user-defined comment.intGets the compression level.intGets the deflater strategy.Gets the Extra subfields from the header.Deprecated.Gets the file name.Gets the Charset to use for writing file names and comments.Gets the most recent modification time (MTIME) of the original file being compressed.longGets the most recent modification time (MTIME) of the original file being compressed, in seconds since 00:00:00 GMT, Jan.intGets the OS code type.getOS()Gets the OS type.private StringrequireNonNulByte(String text) voidsetBufferSize(int bufferSize) Sets size of the buffer used to retrieve compressed data fromDeflaterand write to underlyingOutputStream.voidsetComment(String comment) Sets an arbitrary user-defined comment.voidsetCompressionLevel(int compressionLevel) Sets the compression level.voidsetDeflateStrategy(int deflateStrategy) Sets the deflater strategy.voidsetExtraField(ExtraField extra) Sets the extra subfields.voidsetFileName(String fileName) Sets the name of the compressed file.voidsetFileNameCharset(Charset charset) Sets the Charset to use for writing file names and comments, where null maps toGzipUtils.GZIP_ENCODING.voidsetModificationInstant(Instant modificationTime) Sets the modification time (MTIME) of the compressed file.voidsetModificationTime(long modificationTime) Sets the modification time (MTIME) of the compressed file, in seconds since 00:00:00 GMT, Jan.voidsetOperatingSystem(int operatingSystem) Sets the operating system on which the compression took place.voidSets the operating system on which the compression took place.toString()
-
Field Details
-
OS_FAT
private static final int OS_FAT0: FAT.- See Also:
-
OS_AMIGA
private static final int OS_AMIGA1: Amiga.- See Also:
-
OS_VMS
private static final int OS_VMS2: VMS (or OpenVMS).- See Also:
-
OS_UNIX
private static final int OS_UNIX3: Unix.- See Also:
-
OS_VM_CMS
private static final int OS_VM_CMS4: VM/CMS.- See Also:
-
OS_ATARI_TOS
private static final int OS_ATARI_TOS5: Atari TOS.- See Also:
-
OS_HPFS
private static final int OS_HPFS6: HPFS filesystem (OS/2, NT).- See Also:
-
OS_MACINTOSH
private static final int OS_MACINTOSH7: Macintosh.- See Also:
-
OS_Z_SYSTEM
private static final int OS_Z_SYSTEM8: Z-System.- See Also:
-
OS_CPM
private static final int OS_CPM9: CP/M.- See Also:
-
OS_TOPS_20
private static final int OS_TOPS_2010: TOPS-20.- See Also:
-
OS_NTFS
private static final int OS_NTFS11: NTFS filesystem (NT).- See Also:
-
OS_QDOS
private static final int OS_QDOS12: QDOS.- See Also:
-
OS_ACORN_RISCOS
private static final int OS_ACORN_RISCOS13: Acorn RISCOS.- See Also:
-
OS_UNKNOWN
private static final int OS_UNKNOWN255: unknown.- See Also:
-
compressionLevel
private int compressionLevel -
modificationTime
The most recent modification time (MTIME) of the original file being compressed.The time is in Unix format, for example, seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this may cause problems for MS-DOS and other systems that use local rather than Universal time.) If the compressed data did not come from a file, MTIME is set to the time at which compression started. MTIME = 0 means no time stamp is available.
-
extraField
-
fileName
-
fileNameCharset
-
comment
-
operatingSystem
-
bufferSize
private int bufferSize -
deflateStrategy
private int deflateStrategy
-
-
Constructor Details
-
GzipParameters
public GzipParameters()
-
-
Method Details
-
getBufferSize
public int getBufferSize()Gets size of the buffer used to retrieve compressed data.- Returns:
- The size of the buffer used to retrieve compressed data.
- Since:
- 1.21
- See Also:
-
getComment
Gets an arbitrary user-defined comment.- Returns:
- a user-defined comment.
-
getCompressionLevel
public int getCompressionLevel()Gets the compression level.- Returns:
- the compression level.
- See Also:
-
getDeflateStrategy
public int getDeflateStrategy()Gets the deflater strategy.- Returns:
- the deflater strategy,
Deflater.DEFAULT_STRATEGYby default. - Since:
- 1.23
- See Also:
-
getExtraField
Gets the Extra subfields from the header.- Returns:
- the extra subfields from the header.
- Since:
- 1.28.0
-
getFilename
Deprecated.UsegetFileName().Gets the file name.- Returns:
- the file name.
-
getFileName
Gets the file name.- Returns:
- the file name.
- Since:
- 1.25.0
-
getFileNameCharset
Gets the Charset to use for writing file names and comments.The default value is
GzipUtils.GZIP_ENCODING.- Returns:
- the Charset to use for writing file names and comments.
- Since:
- 1.28.0
-
getModificationInstant
Gets the most recent modification time (MTIME) of the original file being compressed.- Returns:
- the most recent modification time.
- Since:
- 1.28.0
-
getModificationTime
public long getModificationTime()Gets the most recent modification time (MTIME) of the original file being compressed, in seconds since 00:00:00 GMT, Jan. 1, 1970.The time is in Unix format, for example, seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this may cause problems for MS-DOS and other systems that use local rather than Universal time.) If the compressed data did not come from a file, MTIME is set to the time at which compression started. MTIME = 0 means no time stamp is available.
- Returns:
- the most recent modification time in seconds since 00:00:00 GMT, Jan. 1, 1970.
-
getOperatingSystem
public int getOperatingSystem()Gets the OS code type.- Returns:
- the OS code type.
-
getOS
Gets the OS type.- Returns:
- the OS type.
- Since:
- 1.28.0
-
requireNonNulByte
-
setBufferSize
public void setBufferSize(int bufferSize) Sets size of the buffer used to retrieve compressed data fromDeflaterand write to underlyingOutputStream.- Parameters:
bufferSize- the bufferSize to set. Must be a positive type.- Since:
- 1.21
-
setComment
Sets an arbitrary user-defined comment.- Parameters:
comment- a user-defined comment.- Throws:
IllegalArgumentException- if the encoded bytes would contain a nul byte '\0' reserved for gzip field termination.
-
setCompressionLevel
public void setCompressionLevel(int compressionLevel) Sets the compression level.- Parameters:
compressionLevel- the compression level (between 0 and 9)- See Also:
-
setDeflateStrategy
public void setDeflateStrategy(int deflateStrategy) Sets the deflater strategy.- Parameters:
deflateStrategy- the new compression strategy- Since:
- 1.23
- See Also:
-
setExtraField
Sets the extra subfields. Note that a non-null extra will appear in the gzip header regardless of the presence of subfields, while a null extra will not appear at all.- Parameters:
extra- the series of extra sub fields.- Since:
- 1.28.0
-
setFileName
Sets the name of the compressed file.- Parameters:
fileName- the name of the file without the directory path- Throws:
IllegalArgumentException- if the encoded bytes would contain a nul byte '\0' reserved for gzip field termination.
-
setFileNameCharset
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:
charset- the Charset to use for writing file names and comments, null maps toGzipUtils.GZIP_ENCODING.- Since:
- 1.28.0
-
setModificationInstant
Sets the modification time (MTIME) of the compressed file.- Parameters:
modificationTime- the modification time, in milliseconds- Since:
- 1.28.0
-
setModificationTime
public void setModificationTime(long modificationTime) Sets the modification time (MTIME) of the compressed file, in seconds since 00:00:00 GMT, Jan. 1, 1970.The time is in Unix format, for example, seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this may cause problems for MS-DOS and other systems that use local rather than Universal time.) If the compressed data did not come from a file, MTIME is set to the time at which compression started. MTIME = 0 means no time stamp is available.
- Parameters:
modificationTime- the modification time, in seconds.
-
setOperatingSystem
public void setOperatingSystem(int operatingSystem) Sets the operating system on which the compression took place. The defined values are:- 0: FAT file system (MS-DOS, OS/2, NT/Win32)
- 1: Amiga
- 2: VMS (or OpenVMS)
- 3: Unix
- 4: VM/CMS
- 5: Atari TOS
- 6: HPFS file system (OS/2, NT)
- 7: Macintosh
- 8: Z-System
- 9: CP/M
- 10: TOPS-20
- 11: NTFS file system (NT)
- 12: QDOS
- 13: Acorn RISCOS
- 255: Unknown
- Parameters:
operatingSystem- the code of the operating system
-
setOS
Sets the operating system on which the compression took place.- Parameters:
os- operating system, null maps toGzipParameters.OS.UNKNOWN.- Since:
- 1.28.0
-
toString
-
getFileName().