WriteArchiveInterface Class Reference

#include <ioarchivehandler.h>

Inheritance diagram for WriteArchiveInterface:

Detailed Description

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")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( WriteArchiveInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.writearchive"   
)
private

◆ Open()

MAXON_METHOD Result<void> Open ( const Url inputFile,
Bool  append,
const String password = String() 
)

Opens an archive for writing.

Parameters
[in]inputFileThe path of the archive.
[in]appendTrue if files shall be added to an existing archive.
[in]passwordAn optional password.
Returns
OK on success.

◆ Close()

MAXON_METHOD Result<void> Close ( )

Closes the archive and finishes all write operations. After that call the file is closed.

Returns
OK on success.

◆ SetCompressionLevel()

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.

Parameters
[in]compressionLevelCompression level depending on the compression algorithm [ zip: 0 (low) ... 9 (high) ].
Returns
OK on success.

◆ GetCompressionLevel()

MAXON_METHOD Int GetCompressionLevel ( ) const

Returns the current compression level.

Returns
The current compression level.

◆ CreateDirectory()

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.

Parameters
[in]nameThe name of the directory. use '/' to separate subdirectories.
[in]dateTimeThe file time/date of the directory.
[in]fileAttributesOS file attributes.
Returns
OK on success.

◆ CreateFile()

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.

Parameters
[in]nameThe name of the directory. use '/' to separate subdirectories.
[in]dateTimeThe file time/date of the directory.
[in]methodGives the method how the file is stores in the archive.
[in]fileAttributesOS file attributes.
[in]cryptCrcCRC for crypting.
Returns
OK on success.

◆ WriteFile()

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.

Parameters
[in]dataBuffer with file data.
Returns
OK on success.

◆ CloseFile()

MAXON_METHOD Result<void> CloseFile ( )

Closes the file opened with CreateFile().

Returns
OK on success.

◆ CopyFile()

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.

Parameters
[in]fnThe source file name.
[in]strThe virtual filename within the archive.
[in]fileAttributesBits for the file attributes. Only corresponding bits in the mask are set/cleared.
[in]fileAttributesMaskThis mask defines, which bits are taken from fileAttributes (mask bit==1) and which are taken from the original file (mask bit==0).
Returns
OK on success.