00001 #ifndef CLASSLIB_TAR_INPUT_STREAM_H 00002 # define CLASSLIB_TAR_INPUT_STREAM_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/zip/TarConstants.h" 00007 # include "classlib/iotools/FilterInputStream.h" 00008 # include <string> 00009 00010 namespace lat { 00011 //<<<<<< PUBLIC DEFINES >>>>>> 00012 //<<<<<< PUBLIC CONSTANTS >>>>>> 00013 //<<<<<< PUBLIC TYPES >>>>>> 00014 00015 class TarMember; 00016 00017 //<<<<<< PUBLIC VARIABLES >>>>>> 00018 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00019 //<<<<<< CLASS DECLARATIONS >>>>>> 00020 00066 class TarInputStream : public FilterInputStream, public TarConstants 00067 { 00068 public: 00069 TarInputStream (InputStream *input); 00070 ~TarInputStream (void); 00071 // no copy constructor 00072 // no assignment operator 00073 00074 using FilterInputStream::read; 00075 virtual TarMember * nextMember (void); 00076 virtual IOSize available (void); 00077 virtual IOSize read (void *into, IOSize n); 00078 virtual IOSize skip (IOSize n); 00079 virtual void closeMember (void); 00080 00081 virtual void close (void); 00082 virtual void reset (void); 00083 00084 private: 00085 bool validate (const void *buf, IOSize length); 00086 std::string extractStr (const void *buf, IOSize max); 00087 00088 TarMember *m_current; //< Current member 00089 IOOffset m_remaining; //< Bytes left of current member 00090 IOOffset m_padding; //< Bytes of padding after member 00091 }; 00092 00093 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00094 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00095 00096 } // namespace lat 00097 #endif // CLASSLIB_TAR_INPUT_STREAM_H