com.myJava.file.archive.zip64
Class DeflaterOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by com.myJava.file.archive.zip64.DeflaterOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
ZipOutputStream

public class DeflaterOutputStream
extends java.io.FilterOutputStream

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.

Version:
1.32, 01/23/03
Author:
David Connelly
This class was derived from the original java.util.zip.DeflaterOutputStream.
Modifications :
Package change.
in / out fields

CAUTION :
This file has been integrated into Areca.
It is has also possibly been adapted to meet Areca's needs. If such modifications has been made, they are described above.
Thanks to the authors for their work.
Areca Build ID : 7299034069467778562
See Also:
Deflater

Field Summary
protected  byte[] buf
          Output buffer for writing compressed data.
protected  java.util.zip.Deflater def
          Compressor for this stream.
protected  byte[] tmp
           
 
Fields inherited from class java.io.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, java.util.zip.Deflater def)
          Creates a new output stream with the specified compressor and a default buffer size.
DeflaterOutputStream(java.io.OutputStream out, java.util.zip.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.
 long getTotalIn()
           
 long getTotalOut()
           
 void resetDeflater()
           
 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 java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tmp

protected byte[] tmp

def

protected java.util.zip.Deflater def
Compressor for this stream.


buf

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

Constructor Detail

DeflaterOutputStream

public DeflaterOutputStream(java.io.OutputStream out,
                            java.util.zip.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.IllegalArgumentException - if size is <= 0

DeflaterOutputStream

public DeflaterOutputStream(java.io.OutputStream out,
                            java.util.zip.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

getTotalIn

public long getTotalIn()

getTotalOut

public long getTotalOut()

resetDeflater

public void resetDeflater()

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 java.io.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 java.io.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

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.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException - if an I/O error has occurred

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