java.util.zip
Class CheckedOutputStream

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.io.OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream 
      extended by java.io.FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream 
          extended by java.util.zip.CheckedOutputStream
All Implemented Interfaces:
Closeable sample code for java.io.Closeable definition code for java.io.Closeable , Flushable sample code for java.io.Flushable definition code for java.io.Flushable

public class CheckedOutputStream
extends FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.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 Also:
Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum

Field Summary
 
Fields inherited from class java.io.FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream
out sample code for java.io.FilterOutputStream.out definition code for java.io.FilterOutputStream.out
 
Constructor Summary
CheckedOutputStream sample code for java.util.zip.CheckedOutputStream.CheckedOutputStream(java.io.OutputStream, java.util.zip.Checksum) definition code for java.util.zip.CheckedOutputStream.CheckedOutputStream(java.io.OutputStream, java.util.zip.Checksum) (OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out, Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum  cksum)
          Creates an output stream with the specified Checksum.
 
Method Summary
 Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum getChecksum sample code for java.util.zip.CheckedOutputStream.getChecksum() definition code for java.util.zip.CheckedOutputStream.getChecksum() ()
          Returns the Checksum for this output stream.
 void write sample code for java.util.zip.CheckedOutputStream.write(byte[], int, int) definition code for java.util.zip.CheckedOutputStream.write(byte[], int, int) (byte[] b, int off, int len)
          Writes an array of bytes.
 void write sample code for java.util.zip.CheckedOutputStream.write(int) definition code for java.util.zip.CheckedOutputStream.write(int) (int b)
          Writes a byte.
 
Methods inherited from class java.io.FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream
close sample code for java.io.FilterOutputStream.close() definition code for java.io.FilterOutputStream.close() , flush sample code for java.io.FilterOutputStream.flush() definition code for java.io.FilterOutputStream.flush() , write sample code for java.io.FilterOutputStream.write(byte[]) definition code for java.io.FilterOutputStream.write(byte[])
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

CheckedOutputStream sample code for java.util.zip.CheckedOutputStream(java.io.OutputStream, java.util.zip.Checksum) definition code for java.util.zip.CheckedOutputStream(java.io.OutputStream, java.util.zip.Checksum)

public CheckedOutputStream(OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out,
                           Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum  cksum)
Creates an output stream with the specified Checksum.

Parameters:
out - the output stream
cksum - the checksum
Method Detail

write sample code for java.util.zip.CheckedOutputStream.write(int) definition code for java.util.zip.CheckedOutputStream.write(int)

public void write(int b)
           throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Writes a byte. Will block until the byte is actually written.

Overrides:
write sample code for java.io.FilterOutputStream.write(int) definition code for java.io.FilterOutputStream.write(int) in class FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream
Parameters:
b - the byte to be written
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error has occurred

write sample code for java.util.zip.CheckedOutputStream.write(byte[], int, int) definition code for java.util.zip.CheckedOutputStream.write(byte[], int, int)

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Writes an array of bytes. Will block until the bytes are actually written.

Overrides:
write sample code for java.io.FilterOutputStream.write(byte[], int, int) definition code for java.io.FilterOutputStream.write(byte[], int, int) in class FilterOutputStream sample code for java.io.FilterOutputStream definition code for java.io.FilterOutputStream
Parameters:
b - the data to be written
off - the start offset of the data
len - the number of bytes to be written
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error has occurred
See Also:
FilterOutputStream.write(int) sample code for java.io.FilterOutputStream.write(int) definition code for java.io.FilterOutputStream.write(int)

getChecksum sample code for java.util.zip.CheckedOutputStream.getChecksum() definition code for java.util.zip.CheckedOutputStream.getChecksum()

public Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum  getChecksum()
Returns the Checksum for this output stream.

Returns:
the Checksum