Android
java.util.zip
public class

java.util.zip.DeflaterOutputStream

java.lang.Object
java.io.OutputStream Closeable Flushable
java.io.FilterOutputStream
java.util.zip.DeflaterOutputStream

The DeflaterOutputStream class implements a stream filter for the writing of compressed data to a stream. Compression is performed by an instance of Deflater.

Known Direct Subclasses
Known Indirect Subclasses

Summary

Fields

protected      byte[]  buf   
protected      Deflater  def   
Fields inherited from class java.io.FilterOutputStream

Public Constructors

            DeflaterOutputStream(OutputStream os, Deflater def)
Constructs a new DeflaterOutputStream instance using os as the underlying stream.
            DeflaterOutputStream(OutputStream os)
Constructs a new DeflaterOutputStream instance using os as the underlying stream.
            DeflaterOutputStream(OutputStream os, Deflater def, int bsize)
Constructs a new DeflaterOutputStream instance using os as the underlying stream.

Public Methods

          void  close()
Writes any unwritten compressed data to the underlying stream, the closes all underlying streams.
          void  finish()
Write any unwritten data to the underlying stream.
          void  write(int i)
Writes the specified byte oneByte to this FilterOutputStream.
          void  write(byte[] buffer, int off, int nbytes)
Compress nbytes of data from buf starting at off and write it to the underlying stream.

Protected Methods

          void  deflate()
Compress the data in the input buffer and write it to the underlying stream.
Methods inherited from class java.io.FilterOutputStream
Methods inherited from class java.io.OutputStream
Methods inherited from class java.lang.Object
Methods inherited from interface java.io.Closeable
Methods inherited from interface java.io.Flushable

Details

Fields

protected byte[] buf

protected Deflater def

Public Constructors

public DeflaterOutputStream(OutputStream os, Deflater def)

Constructs a new DeflaterOutputStream instance using os as the underlying stream. The provided Deflater instance will be used to compress data.

Parameters

os OutputStream to receive compressed data
def Deflater to perform compression

public DeflaterOutputStream(OutputStream os)

Constructs a new DeflaterOutputStream instance using os as the underlying stream.

Parameters

os OutputStream to receive compressed data

public DeflaterOutputStream(OutputStream os, Deflater def, int bsize)

Constructs a new DeflaterOutputStream instance using os as the underlying stream. The provided Deflater instance will be used to compress data. The internal buffer for storing compressed data will be of size bsize.

Parameters

os OutputStream to receive compressed data
def Deflater to perform compression
bsize size of internal compression buffer

Public Methods

public void close()

Writes any unwritten compressed data to the underlying stream, the closes all underlying streams. This stream can no longer be used after close() has been called.

Throws

IOException If an error occurs during close.

public void finish()

Write any unwritten data to the underlying stream. Do not close the stream. This allows subsequent Deflater's to write to the same stream. This Deflater cannot be used again.

Throws

IOException If an error occurs.

public void write(int i)

Writes the specified byte oneByte to this FilterOutputStream. Only the low order byte of oneByte is written. This implementation writes the byte to the target OutputStream.

Parameters

i the byte to be written

Throws

IOException

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

Compress nbytes of data from buf starting at off and write it to the underlying stream.

Parameters

buffer Buffer of data to compress
off offset in buffer to extract data from
nbytes Number of bytes of data to compress and write

Throws

IOException If an error occurs during writing.

Protected Methods

protected void deflate()

Compress the data in the input buffer and write it to the underlying stream.

Throws

IOException If an error occurs during deflation.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56