net.sf.jazzlib
Class GZIPOutputStream
java.lang.Object
java.io.OutputStream
java13.io.FilterOutputStream
net.sf.jazzlib.DeflaterOutputStream
net.sf.jazzlib.GZIPOutputStream
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
- Author:
- John Leuner, Tom Tromey
Field Summary |
protected CRC32 |
crc
CRC-32 value for uncompressed data |
Constructor Summary |
GZIPOutputStream(java.io.OutputStream out)
|
GZIPOutputStream(java.io.OutputStream out,
int size)
Creates a GZIPOutputStream with the specified buffer size |
Method Summary |
void |
close()
Writes remaining compressed output data to the output stream
and closes it. |
void |
finish()
Finishes the stream by calling finish() on the deflater. |
void |
write(byte[] buf,
int off,
int len)
Writes a len bytes from an array to the compressed stream. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
crc
protected CRC32 crc
- CRC-32 value for uncompressed data
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.IOException
- Creates 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
write
public void write(byte[] buf,
int off,
int len)
throws java.io.IOException
- Description copied from class:
DeflaterOutputStream
- Writes a len bytes from an array to the compressed stream.
- Overrides:
write
in class DeflaterOutputStream
- 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
- if an I/O error occurs.- See Also:
java.io.FilterOutputStream#write(int)
close
public void close()
throws java.io.IOException
- Writes remaining compressed output data to the output stream
and closes it.
- Overrides:
close
in class DeflaterOutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.- See Also:
java.io.FilterOutputStream#flush()
,
java.io.FilterOutputStream#out
finish
public void finish()
throws java.io.IOException
- Description copied from class:
DeflaterOutputStream
- Finishes 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:
finish
in class DeflaterOutputStream
- Throws:
java.io.IOException