libdigidocpp
digidoc::ZipSerialize Class Reference

#include <ZipSerialize.h>

Inheritance diagram for digidoc::ZipSerialize:
Inheritance graph
Collaboration diagram for digidoc::ZipSerialize:
Collaboration graph

Public Member Functions

 ZipSerialize (const std::string &path)
virtual ~ZipSerialize ()
std::string extract () throw (IOException)
void create ()
void addFile (const std::string &containerPath, const std::string &path)
void save () throw (IOException)
- Public Member Functions inherited from digidoc::ISerialize
 ISerialize (const std::string &path)
virtual ~ISerialize ()
std::string getPath ()

Private Attributes

ZipSerializePrivated

Additional Inherited Members

- Protected Attributes inherited from digidoc::ISerialize
std::string path

Detailed Description

Definition at line 33 of file ZipSerialize.h.

Constructor & Destructor Documentation

digidoc::ZipSerialize::ZipSerialize ( const std::string &  path)

Initializes ZIP file serializer.

Parameters
path

Definition at line 62 of file ZipSerialize.cpp.

digidoc::ZipSerialize::~ZipSerialize ( )
virtual

Desctructs ZIP file serializer.

Parameters
path

Definition at line 73 of file ZipSerialize.cpp.

Member Function Documentation

void digidoc::ZipSerialize::addFile ( const std::string &  containerPath,
const std::string &  path 
)
virtual

Add new file to ZIP container. The file is actually archived to ZIP container after save() method is called.

Parameters
containerPathfile path inside ZIP file.
pathfull path of the file that should be added to ZIP file.
See Also
create()
save()

Implements digidoc::ISerialize.

Definition at line 256 of file ZipSerialize.cpp.

References DEBUG.

void digidoc::ZipSerialize::create ( )
virtual

Reinitializes ZipSerializer for new ZIP file creation. This method should be called before creating new ZIP file.

See Also
addFile(const std::string& containerPath, const std::string& path)
save()

Implements digidoc::ISerialize.

Definition at line 242 of file ZipSerialize.cpp.

std::string digidoc::ZipSerialize::extract ( ) throw (IOException)
virtual

Extracts all files from ZIP file to a temporary directory on disk.

Returns
returns path, where files from ZIP file were extracted.
Exceptions
IOExceptionthrows exception if there were errors during extracting files to disk.

Implements digidoc::ISerialize.

Definition at line 85 of file ZipSerialize.cpp.

References digidoc::util::File::createTempDirectory(), DEBUG, e, digidoc::util::File::encodeName(), f_string, THROW_IOEXCEPTION, UNZ_END_OF_LIST_OF_FILE, UNZ_OK, unzClose(), unzGoToFirstFile(), unzGoToNextFile(), and unzOpen2().

Here is the call graph for this function:

void digidoc::ZipSerialize::save ( ) throw (IOException)
virtual

Creates new ZIP file and adds all the added files to the ZIP file.

Exceptions
IOExceptionthrows exception if the file to be added did not exists or creating new ZIP file failed.
See Also
create()
addFile(const std::string& containerPath, const std::string& path)

Implements digidoc::ISerialize.

Definition at line 272 of file ZipSerialize.cpp.

References APPEND_STATUS_CREATE, DEBUG, DEF_MEM_LEVEL, digidoc::util::File::encodeName(), f_string, digidoc::util::File::fopen(), digidoc::util::File::modifiedTime(), digidoc::util::File::moveFile(), digidoc::util::File::tempFileName(), THROW_IOEXCEPTION, ZIP_OK, zipClose(), zipCloseFileInZip(), zipOpen2(), zipOpenNewFileInZip4(), and zipWriteInFileInZip().

Here is the call graph for this function:

Member Data Documentation

ZipSerializePrivate* digidoc::ZipSerialize::d
private

Definition at line 45 of file ZipSerialize.h.


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