com.mot.iden.zip
Class DeflaterOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended bycom.mot.iden.zip.FilterOutputStream
          extended bycom.mot.iden.zip.DeflaterOutputStream
Direct Known Subclasses:
GZIPOutputStream, ZipOutputStream

public class DeflaterOutputStream
extends FilterOutputStream

This API is a Licensee Closed Class and is therefore reserved for use by Motorola and it's Licensees

This class implements an output stream filter for compressing data in the "deflate" compression format. It is also used as the basis for other types of compression filters, such as GZIPOutputStream.


MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2001-2003 Motorola, Inc. All Rights Reserved.

See Also:
Deflater

Field Summary
protected  byte[] buf
          Output buffer for writing compressed data.
protected  Deflater def
          Compressor for this stream.
protected  boolean usesDefaultDeflater
           
 
Fields inherited from class com.mot.iden.zip.FilterOutputStream
out
 
Constructor Summary
DeflaterOutputStream(java.io.OutputStream out)
          Creates a new output stream with a defaul compressor and buffer size.
DeflaterOutputStream(java.io.OutputStream out, Deflater def)
          Creates a new output stream with the specified compressor and a default buffer size.
DeflaterOutputStream(java.io.OutputStream out, Deflater def, int size)
          Creates a new output stream with the specified compressor and buffer size.
 
Method Summary
 void close()
          Writes remaining compressed data to the output stream and closes the underlying stream.
protected  void deflate()
          Writes next block of compressed data to the output stream.
 void finish()
          Finishes writing compressed data to the output stream without closing the underlying stream.
 void write(byte[] b, int off, int len)
          Writes an array of bytes to the compressed output stream.
 void write(int b)
          Writes a byte to the compressed output stream.
 
Methods inherited from class com.mot.iden.zip.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

def

protected Deflater def
Compressor for this stream.


buf

protected byte[] buf
Output buffer for writing compressed data.


usesDefaultDeflater

protected boolean usesDefaultDeflater
Constructor Detail

DeflaterOutputStream

public DeflaterOutputStream(java.io.OutputStream out,
                            Deflater def,
                            int size)
Creates a new output stream with the specified compressor and buffer size.

Parameters:
out - the output stream
def - the compressor ("deflater")
size - the output buffer size
Throws:
java.lang.NullPointerException - if (out == null || def == null)
java.lang.IllegalArgumentException - if size is <= 0

DeflaterOutputStream

public DeflaterOutputStream(java.io.OutputStream out,
                            Deflater def)
Creates a new output stream with the specified compressor and a default buffer size.

Parameters:
out - the output stream
def - the compressor ("deflater")

DeflaterOutputStream

public DeflaterOutputStream(java.io.OutputStream out)
Creates a new output stream with a defaul compressor and buffer size.

Parameters:
out - the output stream
Method Detail

write

public void write(int b)
           throws java.io.IOException
Writes a byte to the compressed output stream. This method will block until the byte can be written.

Overrides:
write in class FilterOutputStream
Parameters:
b - the byte to be written
Throws:
java.io.IOException - if an I/O error has occurred

write

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

Overrides:
write in class FilterOutputStream
Parameters:
b - the data to be written
off - the start offset of the data
len - the length of the data
Throws:
java.io.IOException - if an I/O error has occurred
See Also:
FilterOutputStream.write(int)

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.

Throws:
java.io.IOException - if an I/O error has occurred

close

public void close()
           throws java.io.IOException
Writes remaining compressed data to the output stream and closes the underlying stream.

Overrides:
close in class FilterOutputStream
Throws:
java.io.IOException - if an I/O error has occurred
See Also:
FilterOutputStream.flush(), FilterOutputStream.out

deflate

protected void deflate()
                throws java.io.IOException
Writes next block of compressed data to the output stream.

Throws:
java.io.IOException - if an I/O error has occurred