Team LiB
Previous Section Next Section

Deflaterjava.util.zip

Java 1.1

This class implements the general ZLIB data-compression algorithm used by the gzip and PKZip compression programs. The constants defined by this class are used to specify the compression strategy and the compression speed/strength tradeoff level to be used. If you set the nowrap argument to the constructor to true, the ZLIB header and checksum data are omitted from the compressed output, which is the format both gzip and PKZip use.

The important methods of this class are setInput( ), which specifies input data to be compressed, and deflate( ), which compresses the data and returns the compressed output. The remaining methods exist so that Deflater can be used for stream-based compression, as it is in higher-level classes, such as GZIPOutputStream and ZipOutputStream. These stream classes are sufficient in most cases. Most applications do not need to use Deflater directly. The Inflater class uncompresses data compressed with a Deflater object.

public class Deflater {
// Public Constructors
     public Deflater( );  
     public Deflater(int level);  
     public Deflater(int level, boolean nowrap);  
// Public Constants
     public static final int BEST_COMPRESSION;                           =9
     public static final int BEST_SPEED;                                 =1
     public static final int DEFAULT_COMPRESSION;                        =-1
     public static final int DEFAULT_STRATEGY;                           =0
     public static final int DEFLATED;                                   =8
     public static final int FILTERED;                                   =1
     public static final int HUFFMAN_ONLY;                               =2
     public static final int NO_COMPRESSION;                             =0
// Public Instance Methods
     public int deflate(byte[ ] b);  
     public int deflate(byte[ ] b, int off, int len);            synchronized
     public void end( );                                   synchronized
     public void finish( );                                synchronized
     public boolean finished( );                           synchronized
     public int getAdler( );                               synchronized default:1
5.0  public long getBytesRead( );                      synchronized default:0
5.0  public long getBytesWritten( );                   synchronized default:0
     public int getTotalIn( );                           default:0
     public int getTotalOut( );                          default:0
     public boolean needsInput( );  
     public void reset( );                                 synchronized
     public void setDictionary(byte[ ] b);  
     public void setDictionary(byte[ ] b, int off, int len);     synchronized
     public void setInput(byte[ ] b);  
     public void setInput(byte[ ] b, int off, int len);          synchronized
     public void setLevel(int level);                    synchronized
     public void setStrategy(int strategy);                       synchronized
// Protected Methods Overriding Object
     protected void finalize( );  
}

Passed To

DeflaterOutputStream.DeflaterOutputStream( )

Type Of

DeflaterOutputStream.def

    Team LiB
    Previous Section Next Section