Java in a Nutshell

Previous Chapter 31
The java.util.zip Package
Next
 

31.3 java.util.zip.CheckedOutputStream (JDK 1.1)

This class is a subclass of java.io.FilterOutputStream that allows data to be written to a stream and a checksum computed on that data at the same time.

To create a CheckedOutputStream you must specify the output stream that it is to write its data to, and you must also specify a Checksum object, such as an instance of Adler32, that implements the particular checksum algorithm you desire. The write() methods are similar to those of other OutputStream classes. The getChecksum() method returns the Checksum object. Note that you must call getValue() on this object in order to obtain the actual checksum value.

public class CheckedOutputStream extends FilterOutputStream {
    // Public Constructor
            public CheckedOutputStream(OutputStream out, Checksum cksum);
    // Public Instance Methods
            public Checksum getChecksum();
            public void write(int b) throws IOException;  // Overrides FilterOutputStream
            public void write(byte[] b, int off, int len) throws IOException;  // Overrides FilterOutputStream
}

Hierarchy:

Object->OutputStream->FilterOutputStream->CheckedOutputStream


Previous Home Next
java.util.zip.CheckedInputStream (JDK 1.1) Book Index java.util.zip.Checksum (JDK 1.1)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java
This HTML Help has been published using the chm2web software.