java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.util.zip.DeflaterOutputStream
com.arranger.jarl.io.GZipOutputStreamEx
- Direct Known Subclasses:
- CompressedOutputStream
- public class GZipOutputStreamEx
- extends java.util.zip.DeflaterOutputStream
This class essentially copies sources of original GZIPOutputStream,
just adds ability to pass in desired compression level into constructor
|
Method Summary |
void |
close()
Writes remaining compressed data to the output stream and closes the
underlying stream. |
void |
finish()
Finishes writing compressed data to the output stream without closing
the underlying stream. |
void |
write(byte[] buf,
int off,
int len)
Writes array of bytes to the compressed output stream. |
private void |
writeHeader()
|
private void |
writeInt(int i)
|
private void |
writeShort(int s)
|
private void |
writeTrailer()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
crc
protected java.util.zip.CRC32 crc
- CRC-32 of uncompressed data.
GZIP_MAGIC
private static final int GZIP_MAGIC
- See Also:
- Constant Field Values
GZipOutputStreamEx
public GZipOutputStreamEx(java.io.OutputStream out,
int size,
int compression)
throws java.io.IOException
- Creates a new output stream with the specified buffer size.
GZipOutputStreamEx
public GZipOutputStreamEx(java.io.OutputStream out,
int compression)
throws java.io.IOException
- Creates a new output stream with a default buffer size.
write
public void write(byte[] buf,
int off,
int len)
throws java.io.IOException
- Writes array of bytes to the compressed output stream. This method
will block until all the bytes are written.
finish
public void finish()
throws java.io.IOException
- Finishes writing compressed data to the output stream without closing
the underlying stream. Use this method when applying multiple filters
in succession to the same output stream.
close
public void close()
throws java.io.IOException
- Writes remaining compressed data to the output stream and closes the
underlying stream.
writeHeader
private void writeHeader()
throws java.io.IOException
writeTrailer
private void writeTrailer()
throws java.io.IOException
writeInt
private void writeInt(int i)
throws java.io.IOException
writeShort
private void writeShort(int s)
throws java.io.IOException