Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.arranger.jarl.io
Class GZipOutputStreamEx  view GZipOutputStreamEx download GZipOutputStreamEx.java

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byjava.util.zip.DeflaterOutputStream
              extended bycom.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


Field Summary
protected  java.util.zip.CRC32 crc
          CRC-32 of uncompressed data.
private static int GZIP_MAGIC
           
 
Fields inherited from class java.util.zip.DeflaterOutputStream
buf, def
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
GZipOutputStreamEx(java.io.OutputStream out, int compression)
          Creates a new output stream with a default buffer size.
GZipOutputStreamEx(java.io.OutputStream out, int size, int compression)
          Creates a new output stream with the specified buffer size.
 
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.util.zip.DeflaterOutputStream
deflate, flush, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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.

Method Detail

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