Nebula
Loading...
Searching...
No Matches
IO::ZipFileSystem Class Reference

#include <zipfilesystem.h>

Detailed Description

An archive filesystem wrapper for ZIP files.

Uses the zlib and the minizip package under the hood.

Limitations: No write access. No seek on compressed data, the ZipFileSystem will generally decompress an entire file into memory at once, so that the ZipStreamClass can provide random access on the decompressed data. Thus the typical "audio streaming scenario" is not possible from zip files (that's what XACT's sound banks is there for anyway ;)

How to fix the no-seek problem: zlib processes datas in chunks, and cannot seek randomly within a chunk, and the chunk size is dependent on the compress application being used to create the zip file(?), if those internals are known, it would be possible to write a chunked filesystem which keeps buffered chunks around for each client, probably not worth the effort. Another appoach would be to split stream-files into "chunk-files" before compressing, and to read the next complete chunk files when new data is needed. This approach doesn't require changes to the strip filesystem.

Inherits IO::ArchiveFileSystemBase.

Public Member Functions

 ZipFileSystem ()
 constructor
 
virtual ~ZipFileSystem ()
 destructor
 
void Setup ()
 setup the archive file system
 
void Discard ()
 discard the archive file system
 
Ptr< ArchiveFindArchiveWithFile (const URI &fileUri) const
 find first archive which contains the file path
 
Ptr< ArchiveFindArchiveWithDir (const URI &dirUri) const
 find first archive which contains the directory path
 
- Public Member Functions inherited from IO::ArchiveFileSystemBase
 ArchiveFileSystemBase ()
 constructor
 
virtual ~ArchiveFileSystemBase ()
 destructor
 
void Setup ()
 setup the archive file system
 
void Discard ()
 discard the archive file system
 
bool IsValid () const
 return true if archive file system has been setup
 
virtual Ptr< ArchiveMount (const URI &uri)
 mount an archive
 
virtual Ptr< ArchiveMountEmbedded (const URI &uri, const Util::String &rootPath)
 mount an embedded archive
 
virtual void Unmount (const URI &uri)
 unmount an archive by URI
 
virtual void Unmount (const Ptr< Archive > &archive)
 unmount an archive by pointer
 
bool IsMounted (const URI &uri) const
 return true if an archive is mounted
 
bool HasArchives () const
 Any archives mounted?
 
Util::Array< Ptr< Archive > > GetMountedArchives () const
 get an array of all mounted archives
 
Ptr< ArchiveFindArchive (const URI &uri) const
 find a zip archive by its URI, returns invalid ptr if not mounted
 
URI ConvertFileToArchiveURIIfExists (const URI &uri) const
 transparently convert a URI pointing to a file into a matching archive URI
 
URI ConvertDirToArchiveURIIfExists (const URI &uri) const
 transparently convert a URI pointing to a directory into a matching archive URI

 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Private Member Functions

 __DeclareClass (ZipFileSystem)
 
 __DeclareInterfaceSingleton (ZipFileSystem)
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 
- Protected Attributes inherited from IO::ArchiveFileSystemBase
Threading::CriticalSection critSect
 
Util::Dictionary< Util::String, Ptr< Archive > > archives
 
bool isValid
 

Constructor & Destructor Documentation

◆ ZipFileSystem()

IO::ZipFileSystem::ZipFileSystem ( )

constructor

◆ ~ZipFileSystem()

IO::ZipFileSystem::~ZipFileSystem ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

IO::ZipFileSystem::__DeclareClass ( ZipFileSystem )
private

◆ __DeclareInterfaceSingleton()

IO::ZipFileSystem::__DeclareInterfaceSingleton ( ZipFileSystem )
private

◆ Discard()

void IO::ZipFileSystem::Discard ( )

discard the archive file system

◆ FindArchiveWithDir()

Ptr< Archive > IO::ZipFileSystem::FindArchiveWithDir ( const URI & dirUri) const
virtual

find first archive which contains the directory path

Same as FindArchiveWithFile(), but checks for a directory entry in a zip file.

Reimplemented from IO::ArchiveFileSystemBase.

◆ FindArchiveWithFile()

Ptr< Archive > IO::ZipFileSystem::FindArchiveWithFile ( const URI & uri) const
virtual

find first archive which contains the file path

This method takes a normal file URI and checks if the local path of the URI is contained as file entry in any mounted zip archive.

If yes ptr to the zip archive is returned, otherwise a 0 pointer. NOTE: if the same path resides in several zip archives, it is currently not defined which one will be returned (the current implementation returns the first zip archive in alphabetical order which contains the file).

Reimplemented from IO::ArchiveFileSystemBase.

◆ Setup()

void IO::ZipFileSystem::Setup ( )

setup the archive file system

Setup the ZipFileSystem.

Registers the ZipFileStream class.


The documentation for this class was generated from the following files: