FileDocCategorySizeDatePackage
CheckedOutputStream.javaAPI DocJava SE 5 API1750Fri Aug 26 14:57:28 BST 2005java.util.zip

CheckedOutputStream

public class CheckedOutputStream extends FilterOutputStream
An output stream that also maintains a checksum of the data being written. The checksum can then be used to verify the integrity of the output data.
see
Checksum
version
1.18, 12/19/03
author
David Connelly

Fields Summary
private Checksum
cksum
Constructors Summary
public CheckedOutputStream(OutputStream out, Checksum cksum)
Creates an output stream with the specified Checksum.

param
out the output stream
param
cksum the checksum

	super(out);
	this.cksum = cksum;
    
Methods Summary
public java.util.zip.ChecksumgetChecksum()
Returns the Checksum for this output stream.

return
the Checksum

	return cksum;
    
public voidwrite(int b)
Writes a byte. Will block until the byte is actually written.

param
b the byte to be written
exception
IOException if an I/O error has occurred

	out.write(b);
	cksum.update(b);
    
public voidwrite(byte[] b, int off, int len)
Writes an array of bytes. Will block until the bytes are actually written.

param
b the data to be written
param
off the start offset of the data
param
len the number of bytes to be written
exception
IOException if an I/O error has occurred

	out.write(b, off, len);
	cksum.update(b, off, len);