decaf::util::zip::CheckedInputStream Class Reference
An implementation of a FilterInputStream that will maintain a Checksum of the bytes read, the Checksum can then be used to verify the integrity of the input stream.
More...
#include <src/main/decaf/util/zip/CheckedInputStream.h>
Public Member Functions |
| | CheckedInputStream (InputStream *inputStream, Checksum *sum, bool own=false) |
| | Create a new instance of a CheckedInputStream.
|
| virtual | ~CheckedInputStream () |
| Checksum * | getChecksum () const |
| | Returns a Pointer to the Checksum that is in use by this CheckedInputStream.
|
| virtual long long | skip (long long num) |
| | Skips over and discards n bytes of data from this input stream.The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned.The skip method of InputStream creates a byte array and then repeatedly reads into it until num bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method.- Parameters:
-
| num | The number of bytes to skip. |
- Returns:
- total bytes skipped
- Exceptions:
-
| IOException | if an I/O error occurs. |
| UnsupportedOperationException | if the concrete stream class does not support skipping bytes. |
|
Protected Member Functions |
| virtual int | doReadByte () |
| virtual int | doReadArrayBounded (unsigned char *buffer, int size, int offset, int length) |
Detailed Description
An implementation of a FilterInputStream that will maintain a Checksum of the bytes read, the Checksum can then be used to verify the integrity of the input stream.
- Since:
- 1.0
Constructor & Destructor Documentation
| decaf::util::zip::CheckedInputStream::CheckedInputStream |
( |
InputStream * |
inputStream, |
|
|
Checksum * |
sum, |
|
|
bool |
own = false | |
|
) |
| | |
Create a new instance of a CheckedInputStream.
- Parameters:
-
| inputStream | The InputStream instance to Wrap. |
| sum | The Checksum instance to use (does not take ownership of the Pointer). |
| own | Indicates if this filer should take ownership of the InputStream. |
- Exceptions:
-
| NullPointerException | if the Checksum pointer is NULL. |
| virtual decaf::util::zip::CheckedInputStream::~CheckedInputStream |
( |
|
) |
[virtual] |
Member Function Documentation
| virtual int decaf::util::zip::CheckedInputStream::doReadArrayBounded |
( |
unsigned char * |
buffer, |
|
|
int |
size, |
|
|
int |
offset, |
|
|
int |
length | |
|
) |
| | [protected, virtual] |
| virtual int decaf::util::zip::CheckedInputStream::doReadByte |
( |
|
) |
[protected, virtual] |
| Checksum* decaf::util::zip::CheckedInputStream::getChecksum |
( |
|
) |
const [inline] |
| virtual long long decaf::util::zip::CheckedInputStream::skip |
( |
long long |
num |
) |
[virtual] |
Skips over and discards n bytes of data from this input stream.The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned.The skip method of InputStream creates a byte array and then repeatedly reads into it until num bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method.
- Parameters:
-
| num | The number of bytes to skip. |
- Returns:
- total bytes skipped
- Exceptions:
-
| IOException | if an I/O error occurs. |
| UnsupportedOperationException | if the concrete stream class does not support skipping bytes. |
Adds the skipped bytes into the Checksum.
Reimplemented from decaf::io::FilterInputStream.
The documentation for this class was generated from the following file: