当前页面:
在线文档首页 >
JDK 5 Documentation v1.3.1, Java 2 SDK 英文文档
Java 2 Platform SE v1.3.1: Class CheckedInputStream - JDK 5 Documentation v1.3.1, Java 2 SDK 英文文档
java.util.zip
Class CheckedInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--java.util.zip.CheckedInputStream
- public class CheckedInputStream
- extends FilterInputStream
An input stream that also maintains a checksum of the data being read.
The checksum can then be used to verify the integrity of the input data.
- See Also:
Checksum
Method Summary |
Checksum |
getChecksum()
Returns the Checksum for this input stream. |
int |
read()
Reads a byte. |
int |
read(byte[] buf,
int off,
int len)
Reads into an array of bytes. |
long |
skip(long n)
Skips specified number of bytes of input. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CheckedInputStream
public CheckedInputStream(InputStream in,
Checksum cksum)
- Creates an input stream using the specified Checksum.
- Parameters:
in
- the input streamcksum
- the Checksum
read
public int read()
throws IOException
- Reads a byte. Will block if no input is available.
- Overrides:
read
in class FilterInputStream
- Returns:
- the byte read, or -1 if the end of the stream is reached.
- Throws:
IOException
- if an I/O error has occurred
read
public int read(byte[] buf,
int off,
int len)
throws IOException
- Reads into an array of bytes. Will block until some input
is available.
- Overrides:
read
in class FilterInputStream
- Parameters:
buf
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read- Returns:
- the actual number of bytes read, or -1 if the end
of the stream is reached.
- Throws:
IOException
- if an I/O error has occurred
skip
public long skip(long n)
throws IOException
- Skips specified number of bytes of input.
- Overrides:
skip
in class FilterInputStream
- Parameters:
n
- the number of bytes to skip- Returns:
- the actual number of bytes skipped
- Throws:
IOException
- if an I/O error has occurred
getChecksum
public Checksum getChecksum()
- Returns the Checksum for this input stream.
- Returns:
- the Checksum value
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.