wxZipOutputStream
generated from ../src/mod_io/zostream.cppOutput stream for writing zip files. The following sample shows how easy it is to create a zip archive with files from one directory:
var zos = new wxZipOutputStream(new wxFileOutputStream("temp.zip"));
zos.setComment("This archive is created as test");
var dir = new wxDir("c:\\temp");
var trav = new wxDirTraverser();
trav.onFile = function(filename)
{
var entry = new wxZipEntry(filename);
zos.putNextEntry(entry);
var fis = new wxFileInputStream(filename);
var bfs = new wxBufferedOutputStream(zos);
fis.read(bfs);
// Don't forget to sync (flush), otherwise you loose content
bfs.sync();
return wxDirTraverser.CONTINUE;
}
dir.traverse(trav);
Constants
Constructor
wxZipOutputStream
wxZipOutputStream(Stream,
Level = -1)
| Name | Type | Default | Description |
|---|---|---|---|
| Stream | wxOutputStream | An Output stream | |
| Level | Integer | -1 | Level is the compression level to use. It can be a value between 0 and 9 or -1 to use the default value which currently is equivalent to 6. |
Constructs a new wxZipOutputStream object.
Properties
| Name | Type | Description |
|---|---|---|
comment ![]() |
String | The comment of the zip file |
nextEntry ![]() |
wxZipEntry | Closes the current entry if one is open, then reads the meta-data for the next entry and returns it in a wxZipEntry object. The stream is then open and can be read. |
totalEntries ![]() |
Integer | The number of entries in the zip file |
Methods
setComment
setComment(Comment)
| Name | Type | Default | Description |
|---|---|---|---|
| Comment | String |
Sets the comment on the archive

© 2002 - 2007 Franky Braem.