Name

DeflaterOutputStream

Synopsis

This class is a subclass of java.io.FilterOutputStream; it filters a stream of data by compressing (deflating) it and then writing the compressed data to another output stream. To create a DeflaterOutputStream, you must specify both the stream it is to write to and a Deflater object to perform the compression. You can set various options on the Deflater object to specify just what type of compression is to be performed. Once a DeflaterOutputStream is created, its write( ) and close( ) methods are the same as those of other output streams. The InflaterInputStream class can read data written with a DeflaterOutputStream. A DeflaterOutputStream writes raw compressed data; applications often prefer one of its subclasses, GZIPOutputStream or ZipOutputStream, that wraps the raw compressed data within a standard file format.

java.util.zip.DeflaterOutputStream

Figure 16-139. java.util.zip.DeflaterOutputStream

public class DeflaterOutputStream extends java.io.FilterOutputStream {
// Public Constructors
     public DeflaterOutputStream(java.io.OutputStream out);  
     public DeflaterOutputStream(java.io.OutputStream out, Deflater def);  
     public DeflaterOutputStream(java.io.OutputStream out, Deflater def, int size);  
// Public Instance Methods
     public void finish( ) throws java.io.IOException;  
// Public Methods Overriding FilterOutputStream
     public void close( ) throws java.io.IOException;  
     public void write(int ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.