#include <ioarchivehandler.h>
Interface class to write archives.
Public Member Functions | |
MAXON_METHOD Result< void > | Open (const Url &inputFile, Bool append, const String &password=String()) |
MAXON_METHOD Result< void > | Close () |
MAXON_METHOD Result< void > | SetCompressionLevel (Int compressionLevel) |
MAXON_METHOD Int | GetCompressionLevel () const |
MAXON_METHOD Result< void > | CreateDirectory (const String &name, const UniversalDateTime &dateTime, IOATTRIBUTES fileAttributes) |
MAXON_METHOD Result< void > | CreateFile (const String &name, const UniversalDateTime &dateTime, IOARCHIVESTOREMETHOD method, IOATTRIBUTES fileAttributes, UInt32 cryptCrc) |
MAXON_METHOD Result< void > | WriteFile (const Block< const Byte > &data) |
MAXON_METHOD Result< void > | CloseFile () |
MAXON_METHOD Result< void > | CopyFile (const Url &fn, const String &str, IOATTRIBUTES fileAttributes=IOATTRIBUTES::NONE, IOATTRIBUTES fileAttributesMask=IOATTRIBUTES::NONE) |
Private Member Functions | |
MAXON_INTERFACE (WriteArchiveInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.writearchive", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
|
private |
MAXON_METHOD Result<void> Open | ( | const Url & | inputFile, |
Bool | append, | ||
const String & | password = String() |
||
) |
Opens an archive for writing.
[in] | inputFile | The path of the archive. |
[in] | append | True if files shall be added to an existing archive. |
[in] | password | An optional password. |
MAXON_METHOD Result<void> Close | ( | ) |
Closes the archive and finishes all write operations. After that call the file is closed.
MAXON_METHOD Result<void> SetCompressionLevel | ( | Int | compressionLevel | ) |
Sets the compression level for files in the archive. This function can be called before a new CreateFile() operation to change the compression level. One call at the beginning is enough.
[in] | compressionLevel | Compression level depending on the compression algorithm [ zip: 0 (low) ... 9 (high) ]. |
MAXON_METHOD Int GetCompressionLevel | ( | ) | const |
Returns the current compression level.
MAXON_METHOD Result<void> CreateDirectory | ( | const String & | name, |
const UniversalDateTime & | dateTime, | ||
IOATTRIBUTES | fileAttributes | ||
) |
Creates a directory within an archive file. The name should contain '/' as directory separator.
[in] | name | The name of the directory. use '/' to separate subdirectories. |
[in] | dateTime | The file time/date of the directory. |
[in] | fileAttributes | OS file attributes. |
MAXON_METHOD Result<void> CreateFile | ( | const String & | name, |
const UniversalDateTime & | dateTime, | ||
IOARCHIVESTOREMETHOD | method, | ||
IOATTRIBUTES | fileAttributes, | ||
UInt32 | cryptCrc | ||
) |
Creates a file within an archive file. The name should contain '/' as directory separator. Use WriteFile() to write the data into the file. CloseFile() needs to be called to close the file. A file can be directly created within the archive without the need to create the parent directories first.
[in] | name | The name of the directory. use '/' to separate subdirectories. |
[in] | dateTime | The file time/date of the directory. |
[in] | method | Gives the method how the file is stores in the archive. |
[in] | fileAttributes | OS file attributes. |
[in] | cryptCrc | CRC for crypting. |
MAXON_METHOD Result<void> WriteFile | ( | const Block< const Byte > & | data | ) |
Writes data into the given file created by calling CreateFile(). Multiple calls to WriteFile() are possible for one single file.
[in] | data | Buffer with file data. |
MAXON_METHOD Result<void> CloseFile | ( | ) |
Closes the file opened with CreateFile().
MAXON_METHOD Result<void> CopyFile | ( | const Url & | fn, |
const String & | str, | ||
IOATTRIBUTES | fileAttributes = IOATTRIBUTES::NONE , |
||
IOATTRIBUTES | fileAttributesMask = IOATTRIBUTES::NONE |
||
) |
Copies a file into the archive file. The default parameter for the fileAttributes takes the bits from the original file. CopyFile(fn, str, IOATTRIBUTES::OWNER_X, IOATTRIBUTES::OWNER_X | IOATTRIBUTES::GROUP_X | IOATTRIBUTES::PUBLIC_X); will take the original file bits but forces to set the unix X bits ontop of this only for the owner.
[in] | fn | The source file name. |
[in] | str | The virtual filename within the archive. |
[in] | fileAttributes | Bits for the file attributes. Only corresponding bits in the mask are set/cleared. |
[in] | fileAttributesMask | This mask defines, which bits are taken from fileAttributes (mask bit==1) and which are taken from the original file (mask bit==0). |