All Members | Constructors | Methods | Properties | ||
|
|
|
Icon | Member | Description |
---|---|---|
ZipOutputStream(Stream) |
Create a ZipOutputStream, wrapping an existing stream.
|
|
ZipOutputStream(String) |
Create a ZipOutputStream that writes to a filesystem file.
|
|
ZipOutputStream(Stream, Boolean) |
Create a ZipOutputStream.
|
|
AlternateEncoding |
A Text Encoding to use when encoding the filenames and comments for
all the ZipEntry items, during a ZipFile.Save() operation.
|
|
AlternateEncodingUsage |
A flag that tells if and when this instance should apply
AlternateEncoding to encode the filenames and comments associated to
of ZipEntry objects contained within this instance.
|
|
BeginRead(array<Byte>[]()[][], Int32, Int32, AsyncCallback, Object) | HostProtectionAttribute. Begins an asynchronous read operation. (Inherited from Stream.) |
|
BeginWrite(array<Byte>[]()[][], Int32, Int32, AsyncCallback, Object) | HostProtectionAttribute. Begins an asynchronous write operation. (Inherited from Stream.) |
|
CanRead |
Always returns false.
(Overrides Stream.CanRead.) |
|
CanSeek |
Always returns false.
(Overrides Stream.CanSeek.) |
|
CanTimeout | Gets a value that determines whether the current stream can time out. (Inherited from Stream.) |
|
CanWrite |
Always returns true.
(Overrides Stream.CanWrite.) |
|
Close()()()() | Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. (Inherited from Stream.) |
|
CodecBufferSize |
Size of the work buffer to use for the ZLIB codec during compression.
|
|
Comment |
A comment attached to the zip archive.
|
|
CompressionLevel |
Sets the compression level to be used for entries subsequently added to
the zip archive.
|
|
CompressionMethod |
The compression method used on each entry added to the ZipOutputStream.
|
|
ContainsEntry(String) |
Returns true if an entry by the given name has already been written
to the ZipOutputStream.
|
|
CreateObjRef(Type) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
|
CreateWaitHandle()()()() | Obsolete. Allocates a WaitHandle object. (Inherited from Stream.) |
|
DefaultEncoding |
The default text encoding used in zip archives. It is numeric 437, also
known as IBM437.
|
|
Dispose(Boolean) |
Dispose the stream
(Overrides Stream.Dispose(Boolean).) |
|
Dispose()()()() | Releases all resources used by the Stream. (Inherited from Stream.) |
|
EnableZip64 |
Specify whether to use ZIP64 extensions when saving a zip archive.
|
|
Encryption |
The Encryption to use for entries added to the ZipOutputStream.
|
|
EndRead(IAsyncResult) | Waits for the pending asynchronous read to complete. (Inherited from Stream.) |
|
EndWrite(IAsyncResult) | Ends an asynchronous write operation. (Inherited from Stream.) |
|
Equals(Object) | (Inherited from Object.) |
|
Finalize()()()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
|
Flush()()()() |
This is a no-op.
(Overrides Stream.Flush()()()().) |
|
GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetLifetimeService()()()() | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
|
GetType()()()() | Gets the Type of the current instance. (Inherited from Object.) |
|
IgnoreCase |
Whether the ZipOutputStream should use case-insensitive comparisons when
checking for uniqueness of zip entries.
|
|
InitializeLifetimeService()()()() | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
|
Length |
Always returns a NotSupportedException.
(Overrides Stream.Length.) |
|
MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
|
MemberwiseClone()()()() | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
OutputUsedZip64 |
Indicates whether ZIP64 extensions were used when saving the zip archive.
|
|
ParallelDeflateMaxBufferPairs |
The maximum number of buffer pairs to use when performing
parallel compression.
|
|
ParallelDeflateThreshold |
The size threshold for an entry, above which a parallel deflate is used.
|
|
Password |
Sets the password to be used on the ZipOutputStream instance.
|
|
Position |
Setting this property always returns a NotSupportedException. Getting it
returns the value of the Position on the underlying stream.
(Overrides Stream.Position.) |
|
ProvisionalAlternateEncoding | Obsolete.
The text encoding to use when emitting entries into the zip archive, for
those entries whose filenames or comments cannot be encoded with the
default (IBM437) encoding.
|
|
PutNextEntry(String) |
Specify the name of the next entry that will be written to the zip file.
|
|
Read(array<Byte>[]()[][], Int32, Int32) |
This method always throws a NotSupportedException.
(Overrides Stream.Read(array<Byte>[]()[][], Int32, Int32).) |
|
ReadByte()()()() | Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream. (Inherited from Stream.) |
|
ReadTimeout | Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out. (Inherited from Stream.) |
|
Seek(Int64, SeekOrigin) |
This method always throws a NotSupportedException.
(Overrides Stream.Seek(Int64, SeekOrigin).) |
|
SetLength(Int64) |
This method always throws a NotSupportedException.
(Overrides Stream.SetLength(Int64).) |
|
Strategy |
The compression strategy to use for all entries.
|
|
Timestamp |
The type of timestamp attached to the ZipEntry.
|
|
ToString()()()() | Provides a string representation of the instance. (Overrides Object.ToString()()()().) |
|
UseUnicodeAsNecessary | Obsolete.
Indicates whether to encode entry filenames and entry comments using
Unicode (UTF-8).
|
|
Write(array<Byte>[]()[][], Int32, Int32) |
Write the data from the buffer to the stream.
(Overrides Stream.Write(array<Byte>[]()[][], Int32, Int32).) |
|
WriteByte(Byte) | Writes a byte to the current position in the stream and advances the position within the stream by one byte. (Inherited from Stream.) |
|
WriteTimeout | Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out. (Inherited from Stream.) |
This class writes zip files, as defined in the specification for zip files described by PKWare. The compression for this implementation is provided by a managed-code version of Zlib, included with DotNetZip in the classes in the Ionic.Zlib namespace.
This class provides an alternative programming model to the one enabled by the ZipFile class. Use this when creating zip files, as an alternative to the ZipFile class, when you would like to use a Stream type to write the zip file.
Both the ZipOutputStream class and the ZipFile class can be used to create zip files. Both of them support many of the common zip features, including Unicode, different compression levels, and ZIP64. They provide very similar performance when creating zip files.
The ZipFile class is generally easier to use than ZipOutputStream and should be considered a higher-level interface. For example, when creating a zip file via calls to the PutNextEntry() and Write() methods on the ZipOutputStream class, the caller is responsible for opening the file, reading the bytes from the file, writing those bytes into the ZipOutputStream, setting the attributes on the ZipEntry, and setting the created, last modified, and last accessed timestamps on the zip entry. All of these things are done automatically by a call to ZipFile.AddFile(). For this reason, the ZipOutputStream is generally recommended for use only when your application emits arbitrary data, not necessarily data from a filesystem file, directly into a zip file, and does so using a Stream metaphor.
Aside from the differences in programming model, there are other differences in capability between the two classes.
- ZipFile can be used to read and extract zip files, in addition to creating zip files. ZipOutputStream cannot read zip files. If you want to use a stream to read zip files, check out the ZipInputStream class.
- ZipOutputStream does not support the creation of segmented or spanned zip files.
- ZipOutputStream cannot produce a self-extracting archive.
Be aware that the ZipOutputStream class implements the IDisposable interface. In order for ZipOutputStream to produce a valid zip file, you use use it within a using clause (Using in VB), or call the Dispose() method explicitly. See the examples for how to employ a using clause.
Also, a note regarding compression performance: On the desktop .NET Framework, DotNetZip can use a multi-threaded compression implementation that provides significant speed increases on large files, over 300k or so, at the cost of increased memory use at runtime. (The output of the compression is almost exactly the same size). But, the multi-threaded approach incurs a performance hit on smaller files. There's no way for the ZipOutputStream to know whether parallel compression will be beneficial, because the ZipOutputStream does not know how much data you will write through the stream. You may wish to set the ParallelDeflateThreshold property to zero, if you are compressing large files through ZipOutputStream. This will cause parallel compression to be used, always.
Object | |||
MarshalByRefObject | |||
Stream | |||
ZipOutputStream |