#include "TZIPFile.h"

# TZIPFile

class description - source file - inheritance tree (.ps)

## class TZIPFile : public TArchiveFile

| Inheritance Chart:

`TObject`

<-

`TArchiveFile`

<-

`TZIPFile`

        protected:

          Long64_t FindEndHeader()
            UInt_t Get(const void* buffer, Int_t bytes)
             Int_t ReadDirectory()
             Int_t ReadEndHeader(Long64_t pos)
             Int_t ReadMemberHeader(TZIPMember* member)

        public:

                          TZIPFile()
                          TZIPFile(const char* archive, const char* member, TFile* file)
                          TZIPFile(const TZIPFile&)
                  virtual ~TZIPFile()
           static TClass* Class()
          virtual TClass* IsA() const
            virtual Int_t OpenArchive()
                TZIPFile& operator=(const TZIPFile&)
             virtual void Print(Option_t* option) const
            virtual Int_t SetCurrentMember()
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          Long64_t fDirPos     Central directory position
          Long64_t fDirSize    Central directory size
          Long64_t fDirOffset  Central directory offset (from the beginning of the archive)
           TString fComment    Archive comment

        public:

          static const TZIPFile::EZIPConstants kARCHIVE_VERSION
          static const TZIPFile::EZIPConstants kDIR_HEADER_MAGIC
          static const TZIPFile::EZIPConstants kENTRY_HEADER_MAGIC
          static const TZIPFile::EZIPConstants kEND_HEADER_MAGIC
          static const TZIPFile::EZIPConstants kZIP_MAGIC_LEN
          static const TZIPFile::EZIPConstants kMAX_VAR_LEN
          static const TZIPFile::EZIPConstants kMAX_SIZE
          static const TZIPFile::EZIPConstants kDIR_MAGIC_OFF
          static const TZIPFile::EZIPConstants kDIR_VMADE_OFF
          static const TZIPFile::EZIPConstants kDIR_VMADE_LEN
          static const TZIPFile::EZIPConstants kDIR_VREQD_OFF
          static const TZIPFile::EZIPConstants kDIR_VREQD_LEN
          static const TZIPFile::EZIPConstants kDIR_FLAG_OFF
          static const TZIPFile::EZIPConstants kDIR_FLAG_LEN
          static const TZIPFile::EZIPConstants kDIR_METHOD_OFF
          static const TZIPFile::EZIPConstants kDIR_METHOD_LEN
          static const TZIPFile::EZIPConstants kDIR_DATE_OFF
          static const TZIPFile::EZIPConstants kDIR_DATE_LEN
          static const TZIPFile::EZIPConstants kDIR_CRC32_OFF
          static const TZIPFile::EZIPConstants kDIR_CRC32_LEN
          static const TZIPFile::EZIPConstants kDIR_CSIZE_OFF
          static const TZIPFile::EZIPConstants kDIR_CSIZE_LEN
          static const TZIPFile::EZIPConstants kDIR_USIZE_OFF
          static const TZIPFile::EZIPConstants kDIR_USIZE_LEN
          static const TZIPFile::EZIPConstants kDIR_NAMELEN_OFF
          static const TZIPFile::EZIPConstants kDIR_NAMELEN_LEN
          static const TZIPFile::EZIPConstants kDIR_EXTRALEN_OFF
          static const TZIPFile::EZIPConstants kDIR_EXTRALEN_LEN
          static const TZIPFile::EZIPConstants kDIR_COMMENTLEN_OFF
          static const TZIPFile::EZIPConstants kDIR_COMMENTLEN_LEN
          static const TZIPFile::EZIPConstants kDIR_DISK_START_OFF
          static const TZIPFile::EZIPConstants kDIR_DISK_START_LEN
          static const TZIPFile::EZIPConstants kDIR_INT_ATTR_OFF
          static const TZIPFile::EZIPConstants kDIR_INT_ATTR_LEN
          static const TZIPFile::EZIPConstants kDIR_EXT_ATTR_OFF
          static const TZIPFile::EZIPConstants kDIR_EXT_ATTR_LEN
          static const TZIPFile::EZIPConstants kDIR_ENTRY_POS_OFF
          static const TZIPFile::EZIPConstants kDIR_ENTRY_POS_LEN
          static const TZIPFile::EZIPConstants kDIR_HEADER_SIZE
          static const TZIPFile::EZIPConstants kEND_MAGIC_OFF
          static const TZIPFile::EZIPConstants kEND_DISK_OFF
          static const TZIPFile::EZIPConstants kEND_DISK_LEN
          static const TZIPFile::EZIPConstants kEND_DIR_DISK_OFF
          static const TZIPFile::EZIPConstants kEND_DIR_DISK_LEN
          static const TZIPFile::EZIPConstants kEND_DISK_HDRS_OFF
          static const TZIPFile::EZIPConstants kEND_DISK_HDRS_LEN
          static const TZIPFile::EZIPConstants kEND_TOTAL_HDRS_OFF
          static const TZIPFile::EZIPConstants kEND_TOTAL_HDRS_LEN
          static const TZIPFile::EZIPConstants kEND_DIR_SIZE_OFF
          static const TZIPFile::EZIPConstants kEND_DIR_SIZE_LEN
          static const TZIPFile::EZIPConstants kEND_DIR_OFFSET_OFF
          static const TZIPFile::EZIPConstants kEND_DIR_OFFSET_LEN
          static const TZIPFile::EZIPConstants kEND_COMMENTLEN_OFF
          static const TZIPFile::EZIPConstants kEND_COMMENTLEN_LEN
          static const TZIPFile::EZIPConstants kEND_HEADER_SIZE
          static const TZIPFile::EZIPConstants kENTRY_MAGIC_OFF
          static const TZIPFile::EZIPConstants kENTRY_VREQD_OFF
          static const TZIPFile::EZIPConstants kENTRY_VREQD_LEN
          static const TZIPFile::EZIPConstants kENTRY_FLAG_OFF
          static const TZIPFile::EZIPConstants kENTRY_FLAG_LEN
          static const TZIPFile::EZIPConstants kENTRY_METHOD_OFF
          static const TZIPFile::EZIPConstants kENTRY_METHOD_LEN
          static const TZIPFile::EZIPConstants kENTRY_DATE_OFF
          static const TZIPFile::EZIPConstants kENTRY_DATE_LEN
          static const TZIPFile::EZIPConstants kENTRY_CRC32_OFF
          static const TZIPFile::EZIPConstants kENTRY_CRC32_LEN
          static const TZIPFile::EZIPConstants kENTRY_CSIZE_OFF
          static const TZIPFile::EZIPConstants kENTRY_CSIZE_LEN
          static const TZIPFile::EZIPConstants kENTRY_USIZE_OFF
          static const TZIPFile::EZIPConstants kENTRY_USIZE_LEN
          static const TZIPFile::EZIPConstants kENTRY_NAMELEN_OFF
          static const TZIPFile::EZIPConstants kENTRY_NAMELEN_LEN
          static const TZIPFile::EZIPConstants kENTRY_EXTRALEN_OFF
          static const TZIPFile::EZIPConstants kENTRY_EXTRALEN_LEN
          static const TZIPFile::EZIPConstants kENTRY_HEADER_SIZE
          static const TZIPFile::EZIPConstants kSTORED
          static const TZIPFile::EZIPConstants kDEFLATED

## Class Description

     TZIPFile

     This class describes a ZIP archive file containing multiple
     sub-files. Typically the sub-files are ROOT files. Notice that
     the ROOT files should not be compressed when being added to the
     ZIP file, since ROOT files are normally already compressed.
     Such a ZIP file should be created like:

        zip -n root multi file1.root file2.root

     which creates a ZIP file multi.zip.

     A ZIP archive consists of files compressed with the popular ZLIB
     compression algorithm. The archive format is used among others by
     PKZip and Info-ZIP. The compression algorithm is also used by
     GZIP and the PNG graphics standard. The format of the archives is
     explained briefly below. This class provides an interface to read
     such archives.

     A ZIP archive contains a prefix, series of archive members
     (sub-files), and a central directory. In theory the archive could
     span multiple disks (or files) with the central directory of the
     whole archive on the last disk, but this class does not support
     such multi-part archives. The prefix is only used in self-extracting
     executable archive files.

     The members are stored in the archive sequentially, each with a
     local header followed by the (optionally) compressed data; the local
     header describes the member, including its file name and compressed
     and real sizes. The central directory includes the member details
     again, plus allows an extra member comment to be added. The last
     member in the central directory is an end marker that can contain
     a comment for the whole archive. Both the local header and the
     central directory can also carry extra member-specific data; the
     data in the local and global parts can be different.
     The fact that the archive has a global directory makes it efficient
     and allows for only the reading of the desired data, one does not
     have to scan through the whole file to find the desired sub-file.

     Once the archive has been opened, the client can query the members
     and read their contents by asking the archive for an offset where
     the sub-file starts. The members can be accessed in any order.

TZIPFile() : TArchiveFile()

     Default ctor.

TZIPFile(const char *archive, const char *member, TFile *file) : TArchiveFile(archive, member, file)

     Specify the archive name and member name. The member can be a decimal
     number which allows to access the n-th member.

Int_t OpenArchive()

     Open archive and read end-header and directory. Returns -1 in case
     of error, 0 otherwise.

Long64_t FindEndHeader()

     Find the end header of the ZIP archive. Returns 0 in case of error.

Int_t ReadEndHeader(Long64_t pos)

     Read the end header of the ZIP archive including the archive comment
     at the current file position. Check that it really was a single-disk
     archive with all the entries as expected. Most importantly, figure
     out where the central directory begins. Returns -1 in case of error,
     0 otherwise.

Int_t ReadDirectory()

     Read the directory of the ZIP archive. Returns -1 in case of error,
     0 otherwise.

Int_t ReadMemberHeader(TZIPMember *member)

     Read the member header of the ZIP archive. Sets the position where
     the data starts in the member object. Returns -1 in case of error,
     0 otherwise.

Int_t SetCurrentMember()

     Find the desired member in the member array and make it the
     current member. Returns -1 in case member is not found, 0 otherwise.

UInt_t Get(const void *buffer, Int_t bytes)

     Read a "bytes" long little-endian integer value form "buffer".

void Print(Option_t *) const

     Pretty print ZIP archive members.

### Inline Functions

                   void ~TZIPFile()
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
               TZIPFile TZIPFile(const TZIPFile&)
              TZIPFile& operator=(const TZIPFile&)

Author: Fons Rademakers and Lassi Tuura 30/6/04
Last update: root/base:$Name: $:$Id: TZIPFile.cxx,v 1.2 2004/07/08 00:19:59 rdm Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *