00001 #ifndef CLASSLIB_DECOMPRESS_INPUT_STREAM_H 00002 # define CLASSLIB_DECOMPRESS_INPUT_STREAM_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/sysapi/system.h" 00007 # include "classlib/iotools/FilterInputStream.h" 00008 00009 namespace lat { 00010 //<<<<<< PUBLIC DEFINES >>>>>> 00011 //<<<<<< PUBLIC CONSTANTS >>>>>> 00012 //<<<<<< PUBLIC TYPES >>>>>> 00013 00014 class Decompressor; 00015 class Checksum; 00016 class InputStream; 00017 00018 //<<<<<< PUBLIC VARIABLES >>>>>> 00019 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00020 //<<<<<< CLASS DECLARATIONS >>>>>> 00021 00055 class DecompressInputStream : public FilterInputStream 00056 { 00057 public: 00058 enum { DEFAULT_BUF_SIZE = 4096 }; 00059 00060 DecompressInputStream (Decompressor *decompressor, 00061 Checksum *checksum, 00062 InputStream *input, 00063 IOSize bufsize = DEFAULT_BUF_SIZE); 00064 ~DecompressInputStream (void); 00065 00066 using FilterInputStream::read; 00067 virtual IOSize available (void); 00068 virtual IOSize read (void *into, IOSize n); 00069 virtual IOSize skip (IOSize n); 00070 00071 // virtual void reset (void); // FIXME: reset engine, buffers? 00072 virtual void close (void); 00073 00074 virtual unsigned checksum (void) const; 00075 00076 protected: 00077 virtual IOSize fill (void *buffer, IOSize length); 00078 00079 Decompressor *m_decompressor;//< Decompression engine 00080 Checksum *m_checksum; //< Checksum of uncompressed data 00081 unsigned char *m_buffer; //< Decompression buffer 00082 IOSize m_size; //< Decompression buffer size 00083 IOSize m_last; //< Amount of input now in m_buffer 00084 00085 private: 00086 void unread (void); 00087 00088 // undefined, no semantics 00089 DecompressInputStream (const DecompressInputStream &); 00090 DecompressInputStream &operator= (const DecompressInputStream &); 00091 }; 00092 00093 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00094 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00095 00096 } // namespace lat 00097 #endif // CLASSLIB_DECOMPRESS_INPUT_STREAM_H