|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream net.sf.zipme.CheckedInputStream
InputStream that computes a checksum of the data being read using a supplied Checksum object.
Checksum
Field Summary | |
protected java.io.InputStream |
in
This is the subordinate InputStream to which method calls
are redirected |
Constructor Summary | |
CheckedInputStream(java.io.InputStream in,
Checksum sum)
Creates a new CheckInputStream on top of the supplied OutputStream using the supplied Checksum. |
Method Summary | |
int |
available()
Calls the in.available() method. |
void |
close()
This method closes the input stream by closing the input stream that this object is filtering. |
Checksum |
getChecksum()
Returns the Checksum object used. |
void |
mark(int readlimit)
Calls the in.mark(int) method. |
boolean |
markSupported()
Calls the in.markSupported() method. |
int |
read()
Reads one byte, updates the checksum and returns the read byte (or -1 when the end of file was reached). |
int |
read(byte[] buf)
Calls the read(byte[], int, int) overloaded method. |
int |
read(byte[] buf,
int off,
int len)
Reads at most len bytes in the supplied buffer and updates the checksum with it. |
void |
reset()
Calls the in.reset() method. |
long |
skip(long n)
Skips n bytes by reading them in a temporary buffer and updating the the checksum with that buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.InputStream in
InputStream
to which method calls
are redirected
Constructor Detail |
public CheckedInputStream(java.io.InputStream in, Checksum sum)
Method Detail |
public Checksum getChecksum()
getChecksum.getValue()
.
public int read() throws java.io.IOException
java.io.IOException
public int read(byte[] buf) throws java.io.IOException
read(byte[], int, int)
overloaded method.
Note that
this method does not redirect its call directly to a corresponding
method in in
. This allows subclasses to override only the
three argument version of read
.
buf
- The buffer to read bytes into
in.read(byte[], int, int)
java.io.IOException
- If an error occurspublic int read(byte[] buf, int off, int len) throws java.io.IOException
java.io.IOException
public long skip(long n) throws java.io.IOException
java.io.IOException
public void mark(int readlimit)
in.mark(int)
method.
readlimit
- The parameter passed to in.mark(int)
public boolean markSupported()
in.markSupported()
method.
true
if mark/reset is supported, false
otherwisepublic void reset() throws java.io.IOException
in.reset()
method.
java.io.IOException
- If an error occurspublic int available() throws java.io.IOException
in.available()
method.
in.available()
java.io.IOException
- If an error occurspublic void close() throws java.io.IOException
java.io.IOException
- If an error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |