java.util.zip
Class CheckedInputStream

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.io.InputStream sample code for java.io.InputStream definition code for java.io.InputStream 
      extended by java.io.FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.FilterInputStream 
          extended by java.util.zip.CheckedInputStream
All Implemented Interfaces:
Closeable sample code for java.io.Closeable definition code for java.io.Closeable

public class CheckedInputStream
extends FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.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 sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum

Field Summary
 
Fields inherited from class java.io.FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.FilterInputStream
in sample code for java.io.FilterInputStream.in definition code for java.io.FilterInputStream.in
 
Constructor Summary
CheckedInputStream sample code for java.util.zip.CheckedInputStream.CheckedInputStream(java.io.InputStream, java.util.zip.Checksum) definition code for java.util.zip.CheckedInputStream.CheckedInputStream(java.io.InputStream, java.util.zip.Checksum) (InputStream sample code for java.io.InputStream definition code for java.io.InputStream  in, Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum  cksum)
          Creates an input stream using 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.CheckedInputStream.getChecksum() definition code for java.util.zip.CheckedInputStream.getChecksum() ()
          Returns the Checksum for this input stream.
 int read sample code for java.util.zip.CheckedInputStream.read() definition code for java.util.zip.CheckedInputStream.read() ()
          Reads a byte.
 int read sample code for java.util.zip.CheckedInputStream.read(byte[], int, int) definition code for java.util.zip.CheckedInputStream.read(byte[], int, int) (byte[] buf, int off, int len)
          Reads into an array of bytes.
 long skip sample code for java.util.zip.CheckedInputStream.skip(long) definition code for java.util.zip.CheckedInputStream.skip(long) (long n)
          Skips specified number of bytes of input.
 
Methods inherited from class java.io.FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.FilterInputStream
available sample code for java.io.FilterInputStream.available() definition code for java.io.FilterInputStream.available() , close sample code for java.io.FilterInputStream.close() definition code for java.io.FilterInputStream.close() , mark sample code for java.io.FilterInputStream.mark(int) definition code for java.io.FilterInputStream.mark(int) , markSupported sample code for java.io.FilterInputStream.markSupported() definition code for java.io.FilterInputStream.markSupported() , read sample code for java.io.FilterInputStream.read(byte[]) definition code for java.io.FilterInputStream.read(byte[]) , reset sample code for java.io.FilterInputStream.reset() definition code for java.io.FilterInputStream.reset()
 
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

CheckedInputStream sample code for java.util.zip.CheckedInputStream(java.io.InputStream, java.util.zip.Checksum) definition code for java.util.zip.CheckedInputStream(java.io.InputStream, java.util.zip.Checksum)

public CheckedInputStream(InputStream sample code for java.io.InputStream definition code for java.io.InputStream  in,
                          Checksum sample code for java.util.zip.Checksum definition code for java.util.zip.Checksum  cksum)
Creates an input stream using the specified Checksum.

Parameters:
in - the input stream
cksum - the Checksum
Method Detail

read sample code for java.util.zip.CheckedInputStream.read() definition code for java.util.zip.CheckedInputStream.read()

public int read()
         throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Reads a byte. Will block if no input is available.

Overrides:
read sample code for java.io.FilterInputStream.read() definition code for java.io.FilterInputStream.read() in class FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.FilterInputStream
Returns:
the byte read, or -1 if the end of the stream is reached.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error has occurred
See Also:
FilterInputStream.in sample code for java.io.FilterInputStream.in definition code for java.io.FilterInputStream.in

read sample code for java.util.zip.CheckedInputStream.read(byte[], int, int) definition code for java.util.zip.CheckedInputStream.read(byte[], int, int)

public int read(byte[] buf,
                int off,
                int len)
         throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Reads into an array of bytes. Will block until some input is available.

Overrides:
read sample code for java.io.FilterInputStream.read(byte[], int, int) definition code for java.io.FilterInputStream.read(byte[], int, int) in class FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.FilterInputStream
Parameters:
buf - the buffer into which the data is read
off - the start offset of the data
len - 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 sample code for java.io.IOException definition code for java.io.IOException - if an I/O error has occurred
See Also:
FilterInputStream.in sample code for java.io.FilterInputStream.in definition code for java.io.FilterInputStream.in

skip sample code for java.util.zip.CheckedInputStream.skip(long) definition code for java.util.zip.CheckedInputStream.skip(long)

public long skip(long n)
          throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Skips specified number of bytes of input.

Overrides:
skip sample code for java.io.FilterInputStream.skip(long) definition code for java.io.FilterInputStream.skip(long) in class FilterInputStream sample code for java.io.FilterInputStream definition code for java.io.FilterInputStream
Parameters:
n - the number of bytes to skip
Returns:
the actual number of bytes skipped
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error has occurred

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

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

Returns:
the Checksum value