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. The Zip64 extensions are supported so files larger than 2GB can be stored in archives larger than 4 GB. 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() | |
TZIPFile(const char* archive, const char* member, TFile* file) | |
virtual | ~TZIPFile() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TObject::Clear(Option_t* = "") |
virtual TObject* | TObject::Clone(const char* newname = "") const |
virtual Int_t | TObject::Compare(const TObject* obj) const |
virtual void | TObject::Copy(TObject& object) const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
const char* | TArchiveFile::GetArchiveName() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual const char* | TObject::GetIconName() const |
TArchiveMember* | TArchiveFile::GetMember() const |
Long64_t | TArchiveFile::GetMemberFilePosition() const |
Int_t | TArchiveFile::GetMemberIndex() const |
const char* | TArchiveFile::GetMemberName() const |
TObjArray* | TArchiveFile::GetMembers() const |
virtual const char* | TObject::GetName() const |
Int_t | TArchiveFile::GetNumberOfMembers() const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
virtual const char* | TObject::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TObject::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TObject::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | TObject::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
static TArchiveFile* | TArchiveFile::Open(const char* url, TFile* file) |
virtual Int_t | OpenArchive() |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
virtual void | TObject::Paint(Option_t* option = "") |
virtual void | TObject::Pop() |
virtual void | Print(Option_t* option = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual Int_t | SetCurrentMember() |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual Int_t | TArchiveFile::SetMember(const char* member) |
virtual Int_t | TArchiveFile::SetMember(Int_t idx) |
static void | TObject::SetObjectStat(Bool_t stat) |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector&) |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
TZIPFile(const TZIPFile&) | |
Int_t | DecodeZip64ExtendedExtraField(TZIPMember* m, Bool_t global = kTRUE) |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
Long64_t | FindEndHeader() |
UInt_t | Get(const void* buffer, Int_t bytes) |
ULong64_t | Get64(const void* buffer, Int_t bytes) |
void | TObject::MakeZombie() |
TZIPFile& | operator=(const TZIPFile&) |
static Bool_t | TArchiveFile::ParseUrl(const char* url, TString& archive, TString& member, TString& type) |
Int_t | ReadDirectory() |
Int_t | ReadEndHeader(Long64_t pos) |
Int_t | ReadMemberHeader(TZIPMember* member) |
Long64_t | ReadZip64EndLocator(Long64_t pos) |
Int_t | ReadZip64EndRecord(Long64_t pos) |
enum EZIPConstants { | kARCHIVE_VERSION | |
kDIR_HEADER_MAGIC | ||
kENTRY_HEADER_MAGIC | ||
kEND_HEADER_MAGIC | ||
kZIP64_EDR_HEADER_MAGIC | ||
kZIP64_EDL_HEADER_MAGIC | ||
kZIP64_EXTENDED_MAGIC | ||
kZIP_MAGIC_LEN | ||
kMAX_VAR_LEN | ||
kMAX_SIZE | ||
kDIR_MAGIC_OFF | ||
kDIR_VMADE_OFF | ||
kDIR_VMADE_LEN | ||
kDIR_VREQD_OFF | ||
kDIR_VREQD_LEN | ||
kDIR_FLAG_OFF | ||
kDIR_FLAG_LEN | ||
kDIR_METHOD_OFF | ||
kDIR_METHOD_LEN | ||
kDIR_DATE_OFF | ||
kDIR_DATE_LEN | ||
kDIR_CRC32_OFF | ||
kDIR_CRC32_LEN | ||
kDIR_CSIZE_OFF | ||
kDIR_CSIZE_LEN | ||
kDIR_USIZE_OFF | ||
kDIR_USIZE_LEN | ||
kDIR_NAMELEN_OFF | ||
kDIR_NAMELEN_LEN | ||
kDIR_EXTRALEN_OFF | ||
kDIR_EXTRALEN_LEN | ||
kDIR_COMMENTLEN_OFF | ||
kDIR_COMMENTLEN_LEN | ||
kDIR_DISK_START_OFF | ||
kDIR_DISK_START_LEN | ||
kDIR_INT_ATTR_OFF | ||
kDIR_INT_ATTR_LEN | ||
kDIR_EXT_ATTR_OFF | ||
kDIR_EXT_ATTR_LEN | ||
kDIR_ENTRY_POS_OFF | ||
kDIR_ENTRY_POS_LEN | ||
kDIR_HEADER_SIZE | ||
kZIP64_EDR_MAGIC_OFF | ||
kZIP64_EDR_SIZE_OFF | ||
kZIP64_EDR_SIZE_LEN | ||
kZIP64_EDR_VERS_MADE_OFF | ||
kZIP64_EDR_VERS_MADE_LEN | ||
kZIP64_EDR_VERS_EXT_OFF | ||
kZIP64_EDR_VERS_EXT_LEN | ||
kZIP64_EDR_DISK_OFF | ||
kZIP64_EDR_DISK_LEN | ||
kZIP64_EDR_DIR_DISK_OFF | ||
kZIP64_EDR_DIR_DISK_LEN | ||
kZIP64_EDR_DISK_HDRS_OFF | ||
kZIP64_EDR_DISK_HDRS_LEN | ||
kZIP64_EDR_TOTAL_HDRS_OFF | ||
kZIP64_EDR_TOTAL_HDRS_LEN | ||
kZIP64_EDR_DIR_SIZE_OFF | ||
kZIP64_EDR_DIR_SIZE_LEN | ||
kZIP64_EDR_DIR_OFFSET_OFF | ||
kZIP64_EDR_DIR_OFFSET_LEN | ||
kZIP64_EDR_HEADER_SIZE | ||
kZIP64_EDL_MAGIC_OFF | ||
kZIP64_EDL_DISK_OFF | ||
kZIP64_EDL_DISK_LEN | ||
kZIP64_EDL_REC_OFFSET_OFF | ||
kZIP64_EDL_REC_OFFSET_LEN | ||
kZIP64_EDL_TOTAL_DISK_OFF | ||
kZIP64_EDL_TOTAL_DISK_LEN | ||
kZIP64_EDL_HEADER_SIZE | ||
kEND_MAGIC_OFF | ||
kEND_DISK_OFF | ||
kEND_DISK_LEN | ||
kEND_DIR_DISK_OFF | ||
kEND_DIR_DISK_LEN | ||
kEND_DISK_HDRS_OFF | ||
kEND_DISK_HDRS_LEN | ||
kEND_TOTAL_HDRS_OFF | ||
kEND_TOTAL_HDRS_LEN | ||
kEND_DIR_SIZE_OFF | ||
kEND_DIR_SIZE_LEN | ||
kEND_DIR_OFFSET_OFF | ||
kEND_DIR_OFFSET_LEN | ||
kEND_COMMENTLEN_OFF | ||
kEND_COMMENTLEN_LEN | ||
kEND_HEADER_SIZE | ||
kENTRY_MAGIC_OFF | ||
kENTRY_VREQD_OFF | ||
kENTRY_VREQD_LEN | ||
kENTRY_FLAG_OFF | ||
kENTRY_FLAG_LEN | ||
kENTRY_METHOD_OFF | ||
kENTRY_METHOD_LEN | ||
kENTRY_DATE_OFF | ||
kENTRY_DATE_LEN | ||
kENTRY_CRC32_OFF | ||
kENTRY_CRC32_LEN | ||
kENTRY_CSIZE_OFF | ||
kENTRY_CSIZE_LEN | ||
kENTRY_USIZE_OFF | ||
kENTRY_USIZE_LEN | ||
kENTRY_NAMELEN_OFF | ||
kENTRY_NAMELEN_LEN | ||
kENTRY_EXTRALEN_OFF | ||
kENTRY_EXTRALEN_LEN | ||
kENTRY_HEADER_SIZE | ||
kZIP64_EXTENDED_MAGIC_OFF | ||
kZIP64_EXTENDED_MAGIC_LEN | ||
kZIP64_EXTENDED_SIZE_OFF | ||
kZIP64_EXTENDED_SIZE_LEN | ||
kZIP64_EXTENDED_USIZE_OFF | ||
kZIP64_EXTENDED_USIZE_LEN | ||
kZIP64_EXTENTED_CSIZE_OFF | ||
kZIP64_EXTENDED_CSIZE_LEN | ||
kZIP64_EXTENDED_HDR_OFFSET_OFF | ||
kZIP64_EXTENDED_HDR_OFFSET_LEN | ||
kZIP64_EXTENDED_DISK_OFF | ||
kZIP64_EXTENDED_DISK_LEN | ||
kZIP64_EXTENDED_SIZE | ||
kSTORED | ||
kDEFLATED | ||
}; | ||
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
TString | TArchiveFile::fArchiveName | Archive file name |
TString | fComment | Archive comment |
TArchiveMember* | TArchiveFile::fCurMember | Current archive member |
Long64_t | fDirOffset | Central directory offset (from the beginning of the archive) |
Long64_t | fDirPos | Central directory position |
Long64_t | fDirSize | Central directory size |
TFile* | TArchiveFile::fFile | File stream used to access the archive |
Int_t | TArchiveFile::fMemberIndex | Index of sub-file in archive |
TString | TArchiveFile::fMemberName | Sub-file name |
TObjArray* | TArchiveFile::fMembers | Members in this archive |
Specify the archive name and member name. The member can be a decimal number which allows to access the n-th member.
Open archive and read end-header and directory. Returns -1 in case of error, 0 otherwise.
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.
Read Zip64 end of central directory locator. Returns -1 in case of error, -2 in case end locator magic is not found (i.e. not a zip64 file) and offset of Zip64 end of central directory record in case of success.
Read Zip64 end of central directory record. Returns -1 in case of error and 0 in case of success.
Read the directory of the ZIP archive. Returns -1 in case of error, 0 otherwise.
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.
Find the desired member in the member array and make it the current member. Returns -1 in case member is not found, 0 otherwise.