ROOT » IO » IO » TZIPFile

class TZIPFile: public TArchiveFile


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.


Function Members (Methods)

public:
virtual~TZIPFile()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::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_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
TArchiveMember*TArchiveFile::GetMember() const
Long64_tTArchiveFile::GetMemberFilePosition() const
Int_tTArchiveFile::GetMemberIndex() const
const char*TArchiveFile::GetMemberName() const
TObjArray*TArchiveFile::GetMembers() const
virtual const char*TObject::GetName() const
Int_tTArchiveFile::GetNumberOfMembers() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static TArchiveFile*TArchiveFile::Open(const char* url, TFile* file)
virtual Int_tOpenArchive()
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::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 voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual Int_tSetCurrentMember()
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual Int_tTArchiveFile::SetMember(const char* member)
virtual Int_tTArchiveFile::SetMember(Int_t idx)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TZIPFile()
TZIPFile(const char* archive, const char* member, TFile* file)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
Int_tDecodeZip64ExtendedExtraField(TZIPMember* m, Bool_t global = kTRUE)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
Long64_tFindEndHeader()
UInt_tGet(const void* buffer, Int_t bytes)
ULong64_tGet64(const void* buffer, Int_t bytes)
voidTObject::MakeZombie()
TZIPFile&operator=(const TZIPFile&)
static Bool_tTArchiveFile::ParseUrl(const char* url, TString& archive, TString& member, TString& type)
Int_tReadDirectory()
Int_tReadEndHeader(Long64_t pos)
Int_tReadMemberHeader(TZIPMember* member)
Long64_tReadZip64EndLocator(Long64_t pos)
Int_tReadZip64EndRecord(Long64_t pos)
TZIPFile(const TZIPFile&)

Data Members

public:
static TObject::<anonymous>TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::<anonymous>TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::<anonymous>TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::<anonymous>TObject::kOverwrite
static TObject::<anonymous>TObject::kSingleKey
static TObject::<anonymous>TObject::kWriteDelete
static TObject::<anonymous>TObject::kZombie
protected:
TStringTArchiveFile::fArchiveNameArchive file name
TStringfCommentArchive comment
TArchiveMember*TArchiveFile::fCurMemberCurrent archive member
Long64_tfDirOffsetCentral directory offset (from the beginning of the archive)
Long64_tfDirPosCentral directory position
Long64_tfDirSizeCentral directory size
TFile*TArchiveFile::fFileFile stream used to access the archive
Int_tTArchiveFile::fMemberIndexIndex of sub-file in archive
TStringTArchiveFile::fMemberNameSub-file name
TObjArray*TArchiveFile::fMembersMembers in this archive
static TZIPFile::EZIPConstantskARCHIVE_VERSION
static TZIPFile::EZIPConstantskDEFLATED
static TZIPFile::EZIPConstantskDIR_COMMENTLEN_LEN
static TZIPFile::EZIPConstantskDIR_COMMENTLEN_OFF
static TZIPFile::EZIPConstantskDIR_CRC32_LEN
static TZIPFile::EZIPConstantskDIR_CRC32_OFF
static TZIPFile::EZIPConstantskDIR_CSIZE_LEN
static TZIPFile::EZIPConstantskDIR_CSIZE_OFF
static TZIPFile::EZIPConstantskDIR_DATE_LEN
static TZIPFile::EZIPConstantskDIR_DATE_OFF
static TZIPFile::EZIPConstantskDIR_DISK_START_LEN
static TZIPFile::EZIPConstantskDIR_DISK_START_OFF
static TZIPFile::EZIPConstantskDIR_ENTRY_POS_LEN
static TZIPFile::EZIPConstantskDIR_ENTRY_POS_OFF
static TZIPFile::EZIPConstantskDIR_EXTRALEN_LEN
static TZIPFile::EZIPConstantskDIR_EXTRALEN_OFF
static TZIPFile::EZIPConstantskDIR_EXT_ATTR_LEN
static TZIPFile::EZIPConstantskDIR_EXT_ATTR_OFF
static TZIPFile::EZIPConstantskDIR_FLAG_LEN
static TZIPFile::EZIPConstantskDIR_FLAG_OFF
static TZIPFile::EZIPConstantskDIR_HEADER_MAGIC
static TZIPFile::EZIPConstantskDIR_HEADER_SIZE
static TZIPFile::EZIPConstantskDIR_INT_ATTR_LEN
static TZIPFile::EZIPConstantskDIR_INT_ATTR_OFF
static TZIPFile::EZIPConstantskDIR_MAGIC_OFF
static TZIPFile::EZIPConstantskDIR_METHOD_LEN
static TZIPFile::EZIPConstantskDIR_METHOD_OFF
static TZIPFile::EZIPConstantskDIR_NAMELEN_LEN
static TZIPFile::EZIPConstantskDIR_NAMELEN_OFF
static TZIPFile::EZIPConstantskDIR_USIZE_LEN
static TZIPFile::EZIPConstantskDIR_USIZE_OFF
static TZIPFile::EZIPConstantskDIR_VMADE_LEN
static TZIPFile::EZIPConstantskDIR_VMADE_OFF
static TZIPFile::EZIPConstantskDIR_VREQD_LEN
static TZIPFile::EZIPConstantskDIR_VREQD_OFF
static TZIPFile::EZIPConstantskEND_COMMENTLEN_LEN
static TZIPFile::EZIPConstantskEND_COMMENTLEN_OFF
static TZIPFile::EZIPConstantskEND_DIR_DISK_LEN
static TZIPFile::EZIPConstantskEND_DIR_DISK_OFF
static TZIPFile::EZIPConstantskEND_DIR_OFFSET_LEN
static TZIPFile::EZIPConstantskEND_DIR_OFFSET_OFF
static TZIPFile::EZIPConstantskEND_DIR_SIZE_LEN
static TZIPFile::EZIPConstantskEND_DIR_SIZE_OFF
static TZIPFile::EZIPConstantskEND_DISK_HDRS_LEN
static TZIPFile::EZIPConstantskEND_DISK_HDRS_OFF
static TZIPFile::EZIPConstantskEND_DISK_LEN
static TZIPFile::EZIPConstantskEND_DISK_OFF
static TZIPFile::EZIPConstantskEND_HEADER_MAGIC
static TZIPFile::EZIPConstantskEND_HEADER_SIZE
static TZIPFile::EZIPConstantskEND_MAGIC_OFF
static TZIPFile::EZIPConstantskEND_TOTAL_HDRS_LEN
static TZIPFile::EZIPConstantskEND_TOTAL_HDRS_OFF
static TZIPFile::EZIPConstantskENTRY_CRC32_LEN
static TZIPFile::EZIPConstantskENTRY_CRC32_OFF
static TZIPFile::EZIPConstantskENTRY_CSIZE_LEN
static TZIPFile::EZIPConstantskENTRY_CSIZE_OFF
static TZIPFile::EZIPConstantskENTRY_DATE_LEN
static TZIPFile::EZIPConstantskENTRY_DATE_OFF
static TZIPFile::EZIPConstantskENTRY_EXTRALEN_LEN
static TZIPFile::EZIPConstantskENTRY_EXTRALEN_OFF
static TZIPFile::EZIPConstantskENTRY_FLAG_LEN
static TZIPFile::EZIPConstantskENTRY_FLAG_OFF
static TZIPFile::EZIPConstantskENTRY_HEADER_MAGIC
static TZIPFile::EZIPConstantskENTRY_HEADER_SIZE
static TZIPFile::EZIPConstantskENTRY_MAGIC_OFF
static TZIPFile::EZIPConstantskENTRY_METHOD_LEN
static TZIPFile::EZIPConstantskENTRY_METHOD_OFF
static TZIPFile::EZIPConstantskENTRY_NAMELEN_LEN
static TZIPFile::EZIPConstantskENTRY_NAMELEN_OFF
static TZIPFile::EZIPConstantskENTRY_USIZE_LEN
static TZIPFile::EZIPConstantskENTRY_USIZE_OFF
static TZIPFile::EZIPConstantskENTRY_VREQD_LEN
static TZIPFile::EZIPConstantskENTRY_VREQD_OFF
static TZIPFile::EZIPConstantskMAX_SIZE
static TZIPFile::EZIPConstantskMAX_VAR_LEN
static TZIPFile::EZIPConstantskSTORED
static TZIPFile::EZIPConstantskZIP64_EDL_DISK_LEN
static TZIPFile::EZIPConstantskZIP64_EDL_DISK_OFF
static TZIPFile::EZIPConstantskZIP64_EDL_HEADER_MAGIC
static TZIPFile::EZIPConstantskZIP64_EDL_HEADER_SIZE
static TZIPFile::EZIPConstantskZIP64_EDL_MAGIC_OFF
static TZIPFile::EZIPConstantskZIP64_EDL_REC_OFFSET_LEN
static TZIPFile::EZIPConstantskZIP64_EDL_REC_OFFSET_OFF
static TZIPFile::EZIPConstantskZIP64_EDL_TOTAL_DISK_LEN
static TZIPFile::EZIPConstantskZIP64_EDL_TOTAL_DISK_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_DIR_DISK_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_DIR_DISK_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_DIR_OFFSET_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_DIR_OFFSET_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_DIR_SIZE_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_DIR_SIZE_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_DISK_HDRS_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_DISK_HDRS_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_DISK_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_DISK_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_HEADER_MAGIC
static TZIPFile::EZIPConstantskZIP64_EDR_HEADER_SIZE
static TZIPFile::EZIPConstantskZIP64_EDR_MAGIC_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_SIZE_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_SIZE_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_TOTAL_HDRS_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_TOTAL_HDRS_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_VERS_EXT_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_VERS_EXT_OFF
static TZIPFile::EZIPConstantskZIP64_EDR_VERS_MADE_LEN
static TZIPFile::EZIPConstantskZIP64_EDR_VERS_MADE_OFF
static TZIPFile::EZIPConstantskZIP64_EXTENDED_CSIZE_LEN
static TZIPFile::EZIPConstantskZIP64_EXTENDED_DISK_LEN
static TZIPFile::EZIPConstantskZIP64_EXTENDED_DISK_OFF
static TZIPFile::EZIPConstantskZIP64_EXTENDED_HDR_OFFSET_LEN
static TZIPFile::EZIPConstantskZIP64_EXTENDED_HDR_OFFSET_OFF
static TZIPFile::EZIPConstantskZIP64_EXTENDED_MAGIC
static TZIPFile::EZIPConstantskZIP64_EXTENDED_MAGIC_LEN
static TZIPFile::EZIPConstantskZIP64_EXTENDED_MAGIC_OFF
static TZIPFile::EZIPConstantskZIP64_EXTENDED_SIZE
static TZIPFile::EZIPConstantskZIP64_EXTENDED_SIZE_LEN
static TZIPFile::EZIPConstantskZIP64_EXTENDED_SIZE_OFF
static TZIPFile::EZIPConstantskZIP64_EXTENDED_USIZE_LEN
static TZIPFile::EZIPConstantskZIP64_EXTENDED_USIZE_OFF
static TZIPFile::EZIPConstantskZIP64_EXTENTED_CSIZE_OFF
static TZIPFile::EZIPConstantskZIP_MAGIC_LEN

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TZIPFile()
 Default ctor.
TZIPFile(const char* archive, const char* member, TFile* 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.
Long64_t ReadZip64EndLocator(Long64_t pos)
 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.
Int_t ReadZip64EndRecord(Long64_t pos)
 Read Zip64 end of central directory record. Returns -1 in case of error
 and 0 in case of success.
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 DecodeZip64ExtendedExtraField(TZIPMember* m, Bool_t global = kTRUE)
 Decode the Zip64 extended extra field. If global is true, decode the
 extra field coming from the central directory, if false decode the
 extra field coming from the local file header. Returns -1 in case of
 error, -2 in case Zip64 extra block was not found and 0 in case of
 success.
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 from "buffer".
ULong64_t Get64(const void* buffer, Int_t bytes)
 Read a 8 byte long little-endian integer value from "buffer".
void Print(Option_t* option = "") const
 Pretty print ZIP archive members.
TZIPFile(const TZIPFile& )
TZIPFile& operator=(const TZIPFile& )
virtual ~TZIPFile()
{ }