Package net.sf.jazzlib
Class GZIPOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- net.sf.jazzlib.DeflaterOutputStream
-
- net.sf.jazzlib.GZIPOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class GZIPOutputStream extends DeflaterOutputStream
This filter stream is used to compress a stream into a "GZIP" stream. The "GZIP" format is described in RFC 1952.- Since:
- JDK 1.1
-
-
Field Summary
Fields Modifier and Type Field Description protected CRC32crcCRC-32 value for uncompressed data-
Fields inherited from class net.sf.jazzlib.DeflaterOutputStream
buf, def
-
-
Constructor Summary
Constructors Constructor Description GZIPOutputStream(java.io.OutputStream out)GZIPOutputStream(java.io.OutputStream out, int size)Creates a GZIPOutputStream with the specified buffer size
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Writes remaining compressed output data to the output stream and closes it.voidfinish()Finishes the stream by calling finish() on the deflater.voidwrite(byte[] buf, int off, int len)Writes a len bytes from an array to the compressed stream.-
Methods inherited from class net.sf.jazzlib.DeflaterOutputStream
deflate, flush, write
-
-
-
-
Field Detail
-
crc
protected CRC32 crc
CRC-32 value for uncompressed data
-
-
Constructor Detail
-
GZIPOutputStream
public GZIPOutputStream(java.io.OutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
GZIPOutputStream
public GZIPOutputStream(java.io.OutputStream out, int size) throws java.io.IOExceptionCreates a GZIPOutputStream with the specified buffer size- Parameters:
out- The stream to read compressed data fromsize- Size of the buffer to use- Throws:
java.io.IOException
-
-
Method Detail
-
write
public void write(byte[] buf, int off, int len) throws java.io.IOExceptionDescription copied from class:DeflaterOutputStreamWrites a len bytes from an array to the compressed stream.- Overrides:
writein classDeflaterOutputStream- Parameters:
buf- the byte array.off- the offset into the byte array where to start.len- the number of bytes to write.- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionWrites remaining compressed output data to the output stream and closes it.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classDeflaterOutputStream- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionDescription copied from class:DeflaterOutputStreamFinishes the stream by calling finish() on the deflater. This was the only way to ensure that all bytes are flushed in Sun's JDK.- Overrides:
finishin classDeflaterOutputStream- Throws:
java.io.IOException
-
-