public class

GZIPOutputStream

extends DeflaterOutputStream
java.lang.Object
   ↳ java.io.OutputStream
     ↳ java.io.FilterOutputStream
       ↳ java.util.zip.DeflaterOutputStream
         ↳ java.util.zip.GZIPOutputStream

Class Overview

The GZIPOutputStream class is used to write data to a stream in the GZIP storage format.

Summary

Fields
protected CRC32 crc The checksum algorithm used when treating uncompressed data.
[Expand]
Inherited Fields
From class java.util.zip.DeflaterOutputStream
From class java.io.FilterOutputStream
Public Constructors
GZIPOutputStream(OutputStream os)
Construct a new GZIPOutputStream to write data in GZIP format to the underlying stream.
GZIPOutputStream(OutputStream os, int size)
Construct a new GZIPOutputStream to write data in GZIP format to the underlying stream.
Public Methods
void finish()
Indicates to the stream that all data has been written out, and any GZIP terminal data can now be written.
void write(byte[] buffer, int off, int nbytes)
Write up to nbytes of data from the given buffer, starting at offset off, to the underlying stream in GZIP format.
[Expand]
Inherited Methods
From class java.util.zip.DeflaterOutputStream
From class java.io.FilterOutputStream
From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable

Fields

protected CRC32 crc

Since: API Level 1

The checksum algorithm used when treating uncompressed data.

Public Constructors

public GZIPOutputStream (OutputStream os)

Since: API Level 1

Construct a new GZIPOutputStream to write data in GZIP format to the underlying stream.

Parameters
os the OutputStream to write data to.
Throws
IOException if an IOException occurs.

public GZIPOutputStream (OutputStream os, int size)

Since: API Level 1

Construct a new GZIPOutputStream to write data in GZIP format to the underlying stream. Set the internal compression buffer to size size.

Parameters
os the OutputStream to write to.
size the internal buffer size.
Throws
IOException if an IOException occurs.

Public Methods

public void finish ()

Since: API Level 1

Indicates to the stream that all data has been written out, and any GZIP terminal data can now be written.

Throws
IOException if an IOException occurs.

public void write (byte[] buffer, int off, int nbytes)

Since: API Level 1

Write up to nbytes of data from the given buffer, starting at offset off, to the underlying stream in GZIP format.

Parameters
buffer the buffer of data to compress.
off offset in buffer to extract data from.
nbytes the number of bytes of data to read from the buffer.
Throws
IOException