org.entityfs.support.io
Class ChecksumInputStream<T extends Checksum>
java.lang.Object
java.io.InputStream
org.entityfs.support.io.InputStreamProxy
org.entityfs.support.io.ChecksumInputStream<T>
- All Implemented Interfaces:
- Closeable
public class ChecksumInputStream<T extends Checksum>
- extends InputStreamProxy
This InputStream
calculates the checksum of the data it reads from a
wrapped stream.
- Since:
- 1.1
- Author:
- Karl Gustafsson
- In_jar:
- entityfs-core
ChecksumInputStream
public ChecksumInputStream(InputStream wrapped,
T checksum)
- Create a new checksum input stream.
- Parameters:
wrapped
- The stream to read data from.checksum
- The checksum object to use for calculating the checksum.
read
public int read()
throws IOException
- Overrides:
read
in class InputStreamProxy
- Throws:
IOException
read
public int read(byte[] barr)
throws IOException
- Overrides:
read
in class InputStreamProxy
- Throws:
IOException
read
public int read(byte[] barr,
int off,
int len)
throws IOException
- Overrides:
read
in class InputStreamProxy
- Throws:
IOException
skip
public long skip(long n)
throws IOException
- Overrides:
skip
in class InputStreamProxy
- Throws:
IOException
mark
public void mark(int readlimit)
- This method does nothing.
- Overrides:
mark
in class InputStreamProxy
reset
public void reset()
throws IOException
- Overrides:
reset
in class InputStreamProxy
- Throws:
IOException
- Always.
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class InputStreamProxy
- Returns:
false
, always.
getChecksum
public T getChecksum()
- Get the checksum.
- Returns:
- The checksum.