A FilterInputStream that decompresses data read from the wrapped InputStream instance. More...
#include <src/main/decaf/util/zip/InflaterInputStream.h>

Public Member Functions | ||||||||||
| InflaterInputStream (decaf::io::InputStream *inputStream, bool own=false) | ||||||||||
| Create an instance of this class with a default inflater and buffer size. | ||||||||||
| InflaterInputStream (decaf::io::InputStream *inputStream, Inflater *inflater, bool own=false, bool ownInflater=false) | ||||||||||
| Creates a new InflaterInputStream with a user supplied Inflater and a default buffer size. | ||||||||||
| InflaterInputStream (decaf::io::InputStream *inputStream, Inflater *inflater, int bufferSize, bool own=false, bool ownInflater=false) | ||||||||||
| Creates a new DeflateOutputStream with a user supplied Inflater and specified buffer size. | ||||||||||
| virtual | ~InflaterInputStream () | |||||||||
| virtual int | available () const | |||||||||
Indicates the number of bytes available.The default implementation of this methods returns 0. Classes that override this method may return the total number of bytes that are currently available for reading and others may simply return a value of one indicating that there is some data avaiable. The caller should view the result of this method as an absolute.The default implementation of this method returns zero.
| ||||||||||
| virtual void | close () | |||||||||
Closes the InputStream freeing any resources that might have been acquired during the lifetime of this stream.The default implementation of this method does nothing.
| ||||||||||
| 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.
| ||||||||||
| virtual void | mark (int readLimit) | |||||||||
Marks the current position in the stream A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.If a stream instance reports that marks are supported then the stream will ensure that the same bytes can be read again after the reset method is called so long the readLimit is not reached.Calling mark on a closed stream instance should have no effect.The default implementation of this method does nothing.
| ||||||||||
| virtual void | reset () | |||||||||
Repositions this stream to the position at the time the mark method was last called on this input stream.If the method markSupported returns true, then: * If the method mark has not been called since the stream was created, or the number of bytes read from the stream since mark was last called is larger than the argument to mark at that last call, then an IOException might be thrown. * If such an IOException is not thrown, then the stream is reset to a state such that all the bytes read since the most recent call to mark (or since the start of the file, if mark has not been called) will be resupplied to subsequent callers of the read method, followed by any bytes that otherwise would have been the next input data as of the time of the call to reset.If the method markSupported returns false, then: * The call to reset may throw an IOException. * If an IOException is not thrown, then the stream is reset to a fixed state that depends on the particular type of the input stream and how it was created. The bytes that will be supplied to subsequent callers of the read method depend on the particular type of the input stream.The default implementation of this method throws an IOException.
| ||||||||||
| virtual bool | markSupported () const | |||||||||
Determines if this input stream supports the mark and reset methods.Whether or not mark and reset are supported is an invariant property of a particular input stream instance.The default implementation of this method returns false.
| ||||||||||
Protected Member Functions | ||||||||||
| virtual void | fill () | |||||||||
| Fills the input buffer with the next chunk of data. | ||||||||||
| virtual int | doReadByte () | |||||||||
| virtual int | doReadArrayBounded (unsigned char *buffer, int size, int offset, int length) | |||||||||
Protected Attributes | ||||||||||
| Inflater * | inflater | |||||||||
| The Inflater instance to use. | ||||||||||
| std::vector< unsigned char > | buff | |||||||||
| The buffer to hold chunks of data read from the stream before inflation. | ||||||||||
| int | length | |||||||||
| The amount of data currently stored in the input buffer. | ||||||||||
| bool | ownInflater | |||||||||
| bool | atEOF | |||||||||
Static Protected Attributes | ||||||||||
| static const int | DEFAULT_BUFFER_SIZE | |||||||||
A FilterInputStream that decompresses data read from the wrapped InputStream instance.
| decaf::util::zip::InflaterInputStream::InflaterInputStream | ( | decaf::io::InputStream * | inputStream, | |
| bool | own = false | |||
| ) |
Create an instance of this class with a default inflater and buffer size.
| inputStream | The InputStream instance to wrap. | |
| own | Should this Filter take ownership of the InputStream pointer (defaults to false). |
| decaf::util::zip::InflaterInputStream::InflaterInputStream | ( | decaf::io::InputStream * | inputStream, | |
| Inflater * | inflater, | |||
| bool | own = false, |
|||
| bool | ownInflater = false | |||
| ) |
Creates a new InflaterInputStream with a user supplied Inflater and a default buffer size.
When the user supplied a Inflater instance the InflaterInputStream does not take ownership of the Inflater pointer unless the ownInflater parameter is set to true, otherwise the caller is still responsible for deleting the Inflater.
| inputStream | The InputStream instance to wrap. | |
| inflater | The user supplied Inflater to use for decompression. ( | |
| own | Should this filter take ownership of the InputStream pointer (default is false). | |
| ownInflater | Should the filter take ownership of the passed Inflater object (default is false). |
| NullPointerException | if the Inflater given is NULL. |
| decaf::util::zip::InflaterInputStream::InflaterInputStream | ( | decaf::io::InputStream * | inputStream, | |
| Inflater * | inflater, | |||
| int | bufferSize, | |||
| bool | own = false, |
|||
| bool | ownInflater = false | |||
| ) |
Creates a new DeflateOutputStream with a user supplied Inflater and specified buffer size.
When the user supplied a Inflater instance the InflaterInputStream does not take ownership of the Inflater pointer unless the ownInflater parameter is set to true, otherwise the caller is still responsible for deleting the Inflater.
| inputStream | The InputStream instance to wrap. | |
| inflater | The user supplied Inflater to use for decompression. | |
| bufferSize | The size of the input buffer. | |
| own | Should this filter take ownership of the InputStream pointer (default is false). | |
| ownInflater | Should the filter take ownership of the passed Inflater object (default is false). |
| NullPointerException | if the Inflater given is NULL. | |
| IllegalArgumentException | if the bufferSize value is zero. |
| virtual decaf::util::zip::InflaterInputStream::~InflaterInputStream | ( | ) | [virtual] |
| virtual int decaf::util::zip::InflaterInputStream::available | ( | ) | const [virtual] |
Indicates the number of bytes available.The default implementation of this methods returns 0. Classes that override this method may return the total number of bytes that are currently available for reading and others may simply return a value of one indicating that there is some data avaiable. The caller should view the result of this method as an absolute.The default implementation of this method returns zero.
| IOException | if an I/O error occurs. |
Until EOF this method always returns 1, thereafter it always returns 0.
Reimplemented from decaf::io::FilterInputStream.
| virtual void decaf::util::zip::InflaterInputStream::close | ( | ) | [virtual] |
Closes the InputStream freeing any resources that might have been acquired during the lifetime of this stream.The default implementation of this method does nothing.
| IOException | if an I/O error occurs while closing the InputStream. |
Closes any resources associated with this InflaterInputStream.
Reimplemented from decaf::io::FilterInputStream.
| virtual int decaf::util::zip::InflaterInputStream::doReadArrayBounded | ( | unsigned char * | buffer, | |
| int | size, | |||
| int | offset, | |||
| int | length | |||
| ) | [protected, virtual] |
Reimplemented from decaf::io::FilterInputStream.
| virtual int decaf::util::zip::InflaterInputStream::doReadByte | ( | ) | [protected, virtual] |
Reimplemented from decaf::io::FilterInputStream.
| virtual void decaf::util::zip::InflaterInputStream::fill | ( | ) | [protected, virtual] |
Fills the input buffer with the next chunk of data.
| IOException | if an I/O error occurs. |
| virtual void decaf::util::zip::InflaterInputStream::mark | ( | int | readLimit | ) | [virtual] |
Marks the current position in the stream A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.If a stream instance reports that marks are supported then the stream will ensure that the same bytes can be read again after the reset method is called so long the readLimit is not reached.Calling mark on a closed stream instance should have no effect.The default implementation of this method does nothing.
| readLimit | The max bytes read before marked position is invalid. |
Does nothing.
Reimplemented from decaf::io::FilterInputStream.
| virtual bool decaf::util::zip::InflaterInputStream::markSupported | ( | ) | const [virtual] |
Determines if this input stream supports the mark and reset methods.Whether or not mark and reset are supported is an invariant property of a particular input stream instance.The default implementation of this method returns false.
Always returns false.
Reimplemented from decaf::io::FilterInputStream.
| virtual void decaf::util::zip::InflaterInputStream::reset | ( | ) | [virtual] |
Repositions this stream to the position at the time the mark method was last called on this input stream.If the method markSupported returns true, then: * If the method mark has not been called since the stream was created, or the number of bytes read from the stream since mark was last called is larger than the argument to mark at that last call, then an IOException might be thrown. * If such an IOException is not thrown, then the stream is reset to a state such that all the bytes read since the most recent call to mark (or since the start of the file, if mark has not been called) will be resupplied to subsequent callers of the read method, followed by any bytes that otherwise would have been the next input data as of the time of the call to reset.If the method markSupported returns false, then: * The call to reset may throw an IOException. * If an IOException is not thrown, then the stream is reset to a fixed state that depends on the particular type of the input stream and how it was created. The bytes that will be supplied to subsequent callers of the read method depend on the particular type of the input stream.The default implementation of this method throws an IOException.
| IOException | if an I/O error occurs. |
Always throws an IOException when called.
Reimplemented from decaf::io::FilterInputStream.
| virtual long long decaf::util::zip::InflaterInputStream::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.
| num | The number of bytes to skip. |
| IOException | if an I/O error occurs. | |
| UnsupportedOperationException | if the concrete stream class does not support skipping bytes. |
Skips the specified amount of uncompressed input data.
Reimplemented from decaf::io::FilterInputStream.
bool decaf::util::zip::InflaterInputStream::atEOF [protected] |
std::vector<unsigned char> decaf::util::zip::InflaterInputStream::buff [protected] |
The buffer to hold chunks of data read from the stream before inflation.
const int decaf::util::zip::InflaterInputStream::DEFAULT_BUFFER_SIZE [static, protected] |
Inflater* decaf::util::zip::InflaterInputStream::inflater [protected] |
The Inflater instance to use.
int decaf::util::zip::InflaterInputStream::length [protected] |
The amount of data currently stored in the input buffer.
bool decaf::util::zip::InflaterInputStream::ownInflater [protected] |
1.6.1