Class Poco::Zip::Compress
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco::Zip

# class Compress

Library: Zip
Package: Zip
Header: Poco/Zip/Compress.h

## Description

Compresses a directory or files as zip.

## Member Summary

Member Functions: addDirectory, addFile, addRecursive, close, getZipComment, setZipComment

## Constructors

### Compress

Compress(
std::ostream & out,
bool seekableOut
);

seekableOut determines how we write the zip, setting it to true is recommended for local files (smaller zip file), if you are compressing directly to a network, you MUST set it to false

## Destructor

### ~Compress

~Compress();

## Member Functions

### addDirectory

void addDirectory(
const Poco::Path & entryName,
const Poco::DateTime & lastModifiedAt
);

Adds a directory entry excluding all children to the Zip file, entryName must not be empty.

### addFile

void addFile(
std::istream & input,
const Poco::DateTime & lastModifiedAt,
const Poco::Path & fileName,
ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE,
ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM
);

Adds a single file to the Zip File. fileName must not be a directory name.

### addFile

void addFile(
const Poco::Path & file,
const Poco::Path & fileName,
ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE,
ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM
);

Adds a single file to the Zip File. fileName must not be a directory name. The file must exist physically!

### addRecursive

void addRecursive(
const Poco::Path & entry,
ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM,
bool excludeRoot = true,
const Poco::Path & name = Poco::Path ()
);

Adds a directory entry recursively to the zip file, set excludeRoot to false to exclude the parent directory. If excludeRoot is true you can specify an empty name to add the files as relative files

### close

ZipArchive close();

Finalizes the ZipArchive, closes it.

### getZipComment

const std::string & getZipComment() const;

Returns the Zip file comment.

### setZipComment

void setZipComment(
const std::string & comment
);

Sets the Zip file comment.

## Variables

### EDone

Poco::FIFOEvent < const ZipLocalFileHeader > EDone;