加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090310014804/http://developer.android.com:80/reference/java/util/zip/CheckedOutputStream.html
public class

CheckedOutputStream

extends FilterOutputStream
java.lang.Object
   ↳ java.io.OutputStream
     ↳ java.io.FilterOutputStream
       ↳ java.util.zip.CheckedOutputStream

Class Overview

The CheckedOutputStream class is used to maintain a running Checksum of all data written to a stream.

Summary

[Expand]
Inherited Fields
From class java.io.FilterOutputStream
Public Constructors
CheckedOutputStream(OutputStream os, Checksum cs)
Constructs a new CheckedOutputStream on OutputStream os.
Public Methods
Checksum getChecksum()
Returns the Checksum calculated on the stream thus far.
void write(int val)
Writes byte value val to the underlying stream.
void write(byte[] buf, int off, int nbytes)
Writes nbytes of data from buf starting at offset off to the underlying stream.
[Expand]
Inherited Methods
From class java.io.FilterOutputStream
From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable

Public Constructors

public CheckedOutputStream (OutputStream os, Checksum cs)

Constructs a new CheckedOutputStream on OutputStream os. The Checksum will be calculated using the algorithm implemented by csum.

Parameters
os OutputStream to calculate checksum from
cs Type of Checksum to calculate

Public Methods

public Checksum getChecksum ()

Returns the Checksum calculated on the stream thus far.

Returns
  • A java.util.zip.Checksum

public void write (int val)

Writes byte value val to the underlying stream. The Checksum is updated with val.

Parameters
val Value of the byte to write out
Throws
IOException if an IO error has occured

public void write (byte[] buf, int off, int nbytes)

Writes nbytes of data from buf starting at offset off to the underlying stream. The Checksum is updated with the bytes written.

Parameters
buf data to write out
off the start offset of the data
nbytes number of bytes to write out
Throws
IOException if an IO error has occured