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>

Inheritance diagram for decaf::util::zip::CheckedInputStream:
Inheritance graph
[legend]

Public Member Functions

 CheckedInputStream (InputStream *inputStream, Checksum *sum, bool own=false)
 Create a new instance of a CheckedInputStream.
virtual ~CheckedInputStream ()
ChecksumgetChecksum () 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]

Reimplemented from decaf::io::FilterInputStream.

virtual int decaf::util::zip::CheckedInputStream::doReadByte (  )  [protected, virtual]

Reimplemented from decaf::io::FilterInputStream.

Checksum* decaf::util::zip::CheckedInputStream::getChecksum (  )  const [inline]

Returns a Pointer to the Checksum that is in use by this CheckedInputStream.

Returns:
the pointer to the Checksum instance that is in use by this object.
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:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1