MaxOutputSegmentSize Property

DotNetZip

Ionic Zip Library v1.9.1.6 MaxOutputSegmentSize Property
ReferenceIonic.ZipZipFileMaxOutputSegmentSize
The maximum size of an output segment, when saving a split Zip file.
Declaration Syntax
C# Visual Basic Visual C++
public int MaxOutputSegmentSize { get; set; }
Public Property MaxOutputSegmentSize As Integer
	Get
	Set
public:
property int MaxOutputSegmentSize {
	int get ();
	void set (int value);
}
Remarks

Set this to a non-zero value before calling Save()()()() or Save(String) to specify that the ZipFile should be saved as a split archive, also sometimes called a spanned archive. Some also call them multi-file archives.

A split zip archive is saved in a set of discrete filesystem files, rather than in a single file. This is handy when transmitting the archive in email or some other mechanism that has a limit to the size of each file. The first file in a split archive will be named basename.z01, the second will be named basename.z02, and so on. The final file is named basename.zip. According to the zip specification from PKWare, the minimum value is 65536, for a 64k segment size. The maximum number of segments allows in a split archive is 99.

The value of this property determines the maximum size of a split segment when writing a split archive. For example, suppose you have a ZipFile that would save to a single file of 200k. If you set the MaxOutputSegmentSize to 65536 before calling Save(), you will get four distinct output files. On the other hand if you set this property to 256k, then you will get a single-file archive for that ZipFile.

The size of each split output file will be as large as possible, up to the maximum size set here. The zip specification requires that some data fields in a zip archive may not span a split boundary, and an output segment may be smaller than the maximum if necessary to avoid that problem. Also, obviously the final segment of the archive may be smaller than the maximum segment size. Segments will never be larger than the value set with this property.

You can save a split Zip file only when saving to a regular filesystem file. It's not possible to save a split zip file as a self-extracting archive, nor is it possible to save a split zip file to a stream. When saving to a SFX or to a Stream, this property is ignored.

About interoperability: Split or spanned zip files produced by DotNetZip can be read by WinZip or PKZip, and vice-versa. Segmented zip files may not be readable by other tools, if those other tools don't support zip spanning or splitting. When in doubt, test. I don't believe Windows Explorer can extract a split archive.

This property has no effect when reading a split archive. You can read a split archive in the normal way with DotNetZip.

When saving a zip file, if you want a regular zip file rather than a split zip file, don't set this property, or set it to Zero.

If you read a split archive, with Read(String) and then subsequently call ZipFile.Save(), unless you set this property before calling Save(), you will get a normal, single-file archive.

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)