当前位置 类层次 (JDK) 所有类 (JDK) 所有域和方法 (JDK)

类 java.util.zip.CheckedInputStream

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----java.util.zip.CheckedInputStream

public class CheckedInputStream
extends FilterInputStream

一个也维护被写数据校验和的输入流。 校验和可用于验证输入数据的完整性。

参见:
Checksum

构造子索引

CheckedInputStream(InputStream, Checksum)
使用特定的校验和创建输出流。

方法索引

getChecksum()
为该输入流返回校验和。
read()
读一个字节。
read(byte[], int, int)
读入一个字节数组。
skip(long)
跳过指定数目的输入字节。

构造子

CheckedInputStream
 public CheckedInputStream(InputStream in,
                           Checksum cksum)
使用特定的校验和创建输出流。

参数:
in - 输入流
cksum - 校验和

方法

read
 public int read() throws IOException
读一个字节。 没有可用的输入时阻塞。

返回值:
读取的字节;如果已读到流尾则返回 -1。
抛出: IOException
如果发生了一个 I/O 错误
覆盖:
FilterInputStream 中的 read
read
 public int read(byte buf[],
                   int off,
                 int len) throws IOException
读入一个字节数组。将阻塞一直到有输入流。

参数:
buf - 数据读入的缓冲区
off - 数据的初始偏移量
len - 可读入字节的最大数
返回值:
实际读入的字节数,或如果已读到流尾则返回 -1 。
抛出: IOException
如果发生了一个 I/O 错误
覆盖:
FilterInputStream 中的 read
skip
 public long skip(long n) throws IOException
跳过指定数目的输入字节。

参数:
n - 跳过的字节数
返回值:
实际跳过的字节数。
抛出: IOException
如果发生了一个 I/O 错误
覆盖:
FilterInputStream 中的 skip
getChecksum
 public Checksum getChecksum()
为该输入流返回校验和。


当前位置 类层次 (JDK) 所有类 (JDK) 所有域和方法 (JDK)