java.util.zip
Class GZIPOutputStream

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.io.OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream 
      extended by java.io.FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream 
          extended by java.util.zip.DeflaterOutputStream sample code for java.util.zip.DeflaterOutputStream definition code for java.util.zip.DeflaterOutputStream 
              extended by java.util.zip.GZIPOutputStream
All Implemented Interfaces:
Closeable sample code for java.io.Closeable definition code for java.io.Closeable , Flushable sample code for java.io.Flushable definition code for java.io.Flushable

public class GZIPOutputStream
extends DeflaterOutputStream sample code for java.util.zip.DeflaterOutputStream definition code for java.util.zip.DeflaterOutputStream

This class implements a stream filter for writing compressed data in the GZIP file format.


Field Summary
protected  CRC32 sample code for java.util.zip.CRC32 definition code for java.util.zip.CRC32 crc sample code for java.util.zip.GZIPOutputStream.crc definition code for java.util.zip.GZIPOutputStream.crc
          CRC-32 of uncompressed data.
 
Fields inherited from class java.util.zip.DeflaterOutputStream sample code for java.util.zip.DeflaterOutputStream definition code for java.util.zip.DeflaterOutputStream
buf sample code for java.util.zip.DeflaterOutputStream.buf definition code for java.util.zip.DeflaterOutputStream.buf , def sample code for java.util.zip.DeflaterOutputStream.def definition code for java.util.zip.DeflaterOutputStream.def
 
Fields inherited from class java.io.FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream
out sample code for java.io.FilterOutputStream.out definition code for java.io.FilterOutputStream.out
 
Constructor Summary
GZIPOutputStream sample code for java.util.zip.GZIPOutputStream.GZIPOutputStream(java.io.OutputStream) definition code for java.util.zip.GZIPOutputStream.GZIPOutputStream(java.io.OutputStream) (OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out)
          Creates a new output stream with a default buffer size.
GZIPOutputStream sample code for java.util.zip.GZIPOutputStream.GZIPOutputStream(java.io.OutputStream, int) definition code for java.util.zip.GZIPOutputStream.GZIPOutputStream(java.io.OutputStream, int) (OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out, int size)
          Creates a new output stream with the specified buffer size.
 
Method Summary
 void finish sample code for java.util.zip.GZIPOutputStream.finish() definition code for java.util.zip.GZIPOutputStream.finish() ()
          Finishes writing compressed data to the output stream without closing the underlying stream.
 void write sample code for java.util.zip.GZIPOutputStream.write(byte[], int, int) definition code for java.util.zip.GZIPOutputStream.write(byte[], int, int) (byte[] buf, int off, int len)
          Writes array of bytes to the compressed output stream.
 
Methods inherited from class java.util.zip.DeflaterOutputStream sample code for java.util.zip.DeflaterOutputStream definition code for java.util.zip.DeflaterOutputStream
close sample code for java.util.zip.DeflaterOutputStream.close() definition code for java.util.zip.DeflaterOutputStream.close() , deflate sample code for java.util.zip.DeflaterOutputStream.deflate() definition code for java.util.zip.DeflaterOutputStream.deflate() , write sample code for java.util.zip.DeflaterOutputStream.write(int) definition code for java.util.zip.DeflaterOutputStream.write(int)
 
Methods inherited from class java.io.FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream
flush sample code for java.io.FilterOutputStream.flush() definition code for java.io.FilterOutputStream.flush() , write sample code for java.io.FilterOutputStream.write(byte[]) definition code for java.io.FilterOutputStream.write(byte[])
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

crc sample code for java.util.zip.GZIPOutputStream.crc

protected CRC32 sample code for java.util.zip.CRC32 definition code for java.util.zip.CRC32  crc
CRC-32 of uncompressed data.

Constructor Detail

GZIPOutputStream sample code for java.util.zip.GZIPOutputStream(java.io.OutputStream, int) definition code for java.util.zip.GZIPOutputStream(java.io.OutputStream, int)

public GZIPOutputStream(OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out,
                        int size)
                 throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Creates a new output stream with the specified buffer size.

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

GZIPOutputStream sample code for java.util.zip.GZIPOutputStream(java.io.OutputStream) definition code for java.util.zip.GZIPOutputStream(java.io.OutputStream)

public GZIPOutputStream(OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out)
                 throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Creates a new output stream with a default buffer size.

Parameters:
out - the output stream
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.
Method Detail

write sample code for java.util.zip.GZIPOutputStream.write(byte[], int, int) definition code for java.util.zip.GZIPOutputStream.write(byte[], int, int)

public void write(byte[] buf,
                  int off,
                  int len)
           throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Writes array of bytes to the compressed output stream. This method will block until all the bytes are written.

Overrides:
write sample code for java.util.zip.DeflaterOutputStream.write(byte[], int, int) definition code for java.util.zip.DeflaterOutputStream.write(byte[], int, int) in class DeflaterOutputStream sample code for java.util.zip.DeflaterOutputStream definition code for java.util.zip.DeflaterOutputStream
Parameters:
buf - the data to be written
off - the start offset of the data
len - the length of the data
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.
See Also:
FilterOutputStream.write(int) sample code for java.io.FilterOutputStream.write(int) definition code for java.io.FilterOutputStream.write(int)

finish sample code for java.util.zip.GZIPOutputStream.finish() definition code for java.util.zip.GZIPOutputStream.finish()

public void finish()
            throws IOException sample code for java.io.IOException definition code for 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.

Overrides:
finish sample code for java.util.zip.DeflaterOutputStream.finish() definition code for java.util.zip.DeflaterOutputStream.finish() in class DeflaterOutputStream sample code for java.util.zip.DeflaterOutputStream definition code for java.util.zip.DeflaterOutputStream
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error has occurred