|
Java™ by example!
|
|
|
How do I compress using the GZIP algorithm at runtime?
Use the standard API class GZIPOutputStream. Internally, it uses Deflater to compress data. The following example asks the user a file to compress and writes the compressed stream of data to file.gzip. If you want to compress multiple files to the same outputstream, you need to call finish to write the remaining compressed data without closing the stream. Otherwise, call close. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|