org.kohsuke.gzipxml
Class GZipOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--java.util.zip.DeflaterOutputStream
                    |
                    +--java.util.zip.GZIPOutputStream
                          |
                          +--org.kohsuke.gzipxml.GZipOutputStream

public class GZipOutputStream
extends java.util.zip.GZIPOutputStream

Replacement of GZIPOutputStream with additional functionality to specify the compression level.

THIS SOFTWARE IS IN PUBLIC DOMAIN. NO WARRANTY.

Although StreamResult supports the use of Writer, this implementation doesn't, since the gzip compression works on the stream level.

This class also doesn't support the setXXX methods. Calling those methods throw an UnsupportedOperationException.

Author:
Kohsuke Kawaguchi (kk@kohsuke.org)

Field Summary
 
Fields inherited from class java.util.zip.GZIPOutputStream
crc
 
Fields inherited from class java.util.zip.DeflaterOutputStream
buf, def
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
GZipOutputStream(java.io.OutputStream out)
          Creates a new output stream with a default buffer size.
GZipOutputStream(java.io.OutputStream out, int size)
          Creates a new output stream with the specified buffer size.
GZipOutputStream(java.io.OutputStream out, int size, int compressionLevel)
          Creates a new output stream with the specified buffer size.
 
Methods inherited from class java.util.zip.GZIPOutputStream
finish, write
 
Methods inherited from class java.util.zip.DeflaterOutputStream
close, deflate, write
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZipOutputStream

public GZipOutputStream(java.io.OutputStream out)
                 throws java.io.IOException
Creates a new output stream with a default buffer size.

Parameters:
out - the output stream
Throws:
java.io.IOException - If an I/O error has occurred.

GZipOutputStream

public GZipOutputStream(java.io.OutputStream out,
                        int size)
                 throws java.io.IOException
Creates a new output stream with the specified buffer size.

Parameters:
out - the output stream
size - the output buffer size
Throws:
java.io.IOException - If an I/O error has occurred.
java.lang.IllegalArgumentException - if size is <= 0

GZipOutputStream

public GZipOutputStream(java.io.OutputStream out,
                        int size,
                        int compressionLevel)
                 throws java.io.IOException
Creates a new output stream with the specified buffer size.

Parameters:
out - the output stream
size - the output buffer size
compressionLevel - the compression level (0-9). 0 for the fastest compression, 9 for the smallest result.
Throws:
java.io.IOException - If an I/O error has occurred.
java.lang.IllegalArgumentException - if size is <= 0