java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
java.util.zip.CheckedOutputStream
public class CheckedOutputStream
需要维护写入数据校验和的输出流。校验和可用于验证输出数据的完整性。
Checksum
| 字段摘要 |
|---|
| 从类 java.io.FilterOutputStream 继承的字段 |
|---|
out |
| 构造方法摘要 | |
|---|---|
CheckedOutputStream(OutputStream out, Checksum cksum) 使用指定校验和创建输出流。 |
|
| 方法摘要 | |
|---|---|
Checksum |
getChecksum() 返回此输出流的校验和。 |
void |
write(byte[] b, int off, int len) 写入字节数组。 |
void |
write(int b) 写入字节。 |
| 从类 java.io.FilterOutputStream 继承的方法 |
|---|
close, flush, write |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public CheckedOutputStream(OutputStream out, Checksum cksum)
out - 输出流
cksum - 校验和
| 方法详细信息 |
|---|
public void write(int b)
throws IOException
FilterOutputStream 中的
write
b - 要写入的字节
IOException - 如果发生 I/O 错误
public void write(byte[] b,
int off,
int len)
throws IOException
FilterOutputStream 中的
write
b - 要写入的数据
off - 数据的初始偏移量
len - 要写入的字节数
IOException - 如果发生 I/O 错误
FilterOutputStream.write(int)
public Checksum getChecksum()