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.
Summary
Public methods |
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.
|
Inherited methods |
From
class
java.io.FilterInputStream
|
From
class
java.io.InputStream
|
From
class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long millis, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long millis)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
|
From
interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
|
From
interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes this resource, relinquishing any underlying resources.
|
|
Public constructors
CheckedInputStream
CheckedInputStream (InputStream in,
Checksum cksum)
Creates an input stream using the specified Checksum.
Parameters |
in |
InputStream :
the input stream |
cksum |
Checksum :
the Checksum
|
Public methods
getChecksum
Checksum getChecksum ()
Returns the Checksum for this input stream.
read
int read ()
Reads a byte. Will block if no input is available.
Returns |
int |
the byte read, or -1 if the end of the stream is reached. |
read
int read (byte[] buf,
int off,
int len)
Reads into an array of bytes. If len
is not zero, the method
blocks until some input is available; otherwise, no
bytes are read and 0
is returned.
Parameters |
buf |
byte :
the buffer into which the data is read |
off |
int :
the start offset in the destination array b |
len |
int :
the maximum number of bytes read |
Returns |
int |
the actual number of bytes read, or -1 if the end
of the stream is reached. |
skip
long skip (long n)
Skips specified number of bytes of input.
Parameters |
n |
long :
the number of bytes to skip |
Returns |
long |
the actual number of bytes skipped |