00001 #ifndef CLASSLIB_TAR_OUTPUT_STREAM_H 00002 # define CLASSLIB_TAR_OUTPUT_STREAM_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/zip/TarConstants.h" 00007 # include "classlib/iotools/FilterOutputStream.h" 00008 00009 namespace lat { 00010 //<<<<<< PUBLIC DEFINES >>>>>> 00011 //<<<<<< PUBLIC CONSTANTS >>>>>> 00012 //<<<<<< PUBLIC TYPES >>>>>> 00013 00014 class TarMember; 00015 class MemoryStorage; 00016 00017 //<<<<<< PUBLIC VARIABLES >>>>>> 00018 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00019 //<<<<<< CLASS DECLARATIONS >>>>>> 00020 00032 class TarOutputStream : public FilterOutputStream, public TarConstants 00033 { 00034 public: 00035 TarOutputStream (OutputStream *output, bool pad = true); 00036 ~TarOutputStream (void); 00037 // no copy constructor 00038 // no assignment operator 00039 00040 using FilterOutputStream::write; 00041 virtual void setPadding (bool padTrailer); 00042 virtual void nextMember (TarMember *member, bool autobuffer=false); 00043 virtual IOSize write (const void *from, IOSize n); 00044 virtual void closeMember (void); 00045 virtual void finish (void); 00046 00047 protected: 00048 virtual void writeHeader (void); 00049 00050 private: 00051 TarMember *m_current; //< Current member we are writing 00052 MemoryStorage *m_buffer; //< Automatic buffer if requested 00053 IOOffset m_remaining; //< Bytes still to come for this member 00054 IOOffset m_padding; //< Bytes to be pad after this member 00055 IOOffset m_blocks; /*< Number of blocks written 00056 so far, for calculating 00057 the amount of padding at 00058 the end of the archive. */ 00059 bool m_pad; //< Indicates whether to pad at the end 00060 bool m_finished; //< Indicates when #finished() was done 00061 }; 00062 00063 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00064 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00065 00066 } // namespace lat 00067 #endif // CLASSLIB_TAR_OUTPUT_STREAM_H