start page | rating of books | rating of authors | reviews | copyrights

Java in a Nutshell

Previous Chapter 31
The Package

31.3 (JDK 1.1)

This class is a subclass of 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



Previous Home Next (JDK 1.1) Book Index (JDK 1.1)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java