Inheritance diagram for ICSharpCode::SharpZipLib::Zip::ZipOutputStream:
Public Member Functions | |
ZipOutputStream (Stream baseOutputStream) | |
Creates a new Zip output stream, writing a zip archive. | |
void | SetComment (string comment) |
Set the zip file comment. | |
void | SetLevel (int level) |
Sets default compression level. The new level will be activated immediately. | |
int | GetLevel () |
Get the current deflate compression level. | |
void | PutNextEntry (ZipEntry entry) |
Starts a new Zip entry. It automatically closes the previous entry if present. All entry elements bar name are optional, but must be correct if present. If the compression method is stored and the output is not patchable the compression for that entry is automatically changed to deflate level 0. | |
void | CloseEntry () |
Closes the current entry, updating header and footer information as required. | |
override void | Write (byte[] b, int off, int len) |
Writes the given buffer to the current entry. | |
override void | Finish () |
Finishes the stream. This will write the central directory at the end of the zip file and flush the stream. | |
Properties | |
bool | IsFinished |
Gets boolean indicating central header has been added for this archive... No further entries can be added once this has been done. | |
bool | patchEntryHeader = false |
long | headerPatchPos = -1 |
Private Member Functions | |
void | WriteLeShort (int value) |
Write an unsigned short in little endian byte order. | |
void | WriteLeInt (int value) |
Write an int in little endian byte order. | |
void | WriteLeLong (long value) |
Write an int in little endian byte order. | |
void | WriteEncryptionHeader (long crcValue) |
Private Attributes | |
ArrayList | entries = new ArrayList() |
Crc32 | crc = new Crc32() |
ZipEntry | curEntry = null |
int | defaultCompressionLevel = Deflater.DEFAULT_COMPRESSION |
CompressionMethod | curMethod = CompressionMethod.Deflated |
long | size |
long | offset = 0 |
byte[] | zipComment = new byte[0] |
It includes support for Stored and Deflated entries. This class is not thread safe.
Author of the original java version : Jochen Hoenicke
This sample shows how to create a zip file
using System; using System.IO; using ICSharpCode.SharpZipLib.Zip; class MainClass { public static void Main(string[] args) { string[] filenames = Directory.GetFiles(args[0]); ZipOutputStream s = new ZipOutputStream(File.Create(args[1])); s.SetLevel(5); // 0 - store only to 9 - means best compression foreach (string file in filenames) { FileStream fs = File.OpenRead(file); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); ZipEntry entry = new ZipEntry(file); s.PutNextEntry(entry); s.Write(buffer, 0, buffer.Length); } s.Finish(); s.Close(); } }
Definition at line 99 of file ZipOutputStream.cs.
|
Creates a new Zip output stream, writing a zip archive.
Definition at line 130 of file ZipOutputStream.cs. |
|
Closes the current entry, updating header and footer information as required.
Definition at line 374 of file ZipOutputStream.cs. |
|
Finishes the stream. This will write the central directory at the end of the zip file and flush the stream. This is automatically called when the stream is closed.
Reimplemented from ICSharpCode::SharpZipLib::Zip::Compression::Streams::DeflaterOutputStream. Definition at line 512 of file ZipOutputStream.cs. |
|
Get the current deflate compression level.
Definition at line 170 of file ZipOutputStream.cs. |
|
Starts a new Zip entry. It automatically closes the previous entry if present. All entry elements bar name are optional, but must be correct if present. If the compression method is stored and the output is not patchable the compression for that entry is automatically changed to deflate level 0.
Definition at line 228 of file ZipOutputStream.cs. References ICSharpCode::SharpZipLib::Zip::ZipEntry::CompressedSize, ICSharpCode::SharpZipLib::Zip::ZipEntry::CompressionMethod, ICSharpCode::SharpZipLib::Zip::ZipEntry::Crc, ICSharpCode::SharpZipLib::Zip::ZipEntry::DosTime, ICSharpCode::SharpZipLib::Zip::ZipEntry::ExtraData, ICSharpCode::SharpZipLib::Zip::ZipEntry::Flags, ICSharpCode::SharpZipLib::Zip::ZipEntry::IsCrypted, ICSharpCode::SharpZipLib::Zip::ZipEntry::Name, ICSharpCode::SharpZipLib::Zip::ZipEntry::Offset, ICSharpCode::SharpZipLib::Zip::ZipEntry::Size, and ICSharpCode::SharpZipLib::Zip::ZipEntry::Version. |
|
Set the zip file comment.
Definition at line 143 of file ZipOutputStream.cs. |
|
Sets default compression level. The new level will be activated immediately.
Definition at line 160 of file ZipOutputStream.cs. |
|
Writes the given buffer to the current entry.
Reimplemented from ICSharpCode::SharpZipLib::Zip::Compression::Streams::DeflaterOutputStream. Definition at line 463 of file ZipOutputStream.cs. |
|
Definition at line 439 of file ZipOutputStream.cs. |
|
Write an int in little endian byte order.
Definition at line 187 of file ZipOutputStream.cs. |
|
Write an int in little endian byte order.
Definition at line 196 of file ZipOutputStream.cs. |
|
Write an unsigned short in little endian byte order.
Definition at line 178 of file ZipOutputStream.cs. |
|
Definition at line 102 of file ZipOutputStream.cs. |
|
Definition at line 103 of file ZipOutputStream.cs. |
|
Definition at line 106 of file ZipOutputStream.cs. |
|
Definition at line 105 of file ZipOutputStream.cs. |
|
Definition at line 101 of file ZipOutputStream.cs. |
|
Definition at line 110 of file ZipOutputStream.cs. |
|
Definition at line 109 of file ZipOutputStream.cs. |
|
Definition at line 112 of file ZipOutputStream.cs. |
|
Definition at line 205 of file ZipOutputStream.cs. |
|
Gets boolean indicating central header has been added for this archive... No further entries can be added once this has been done.
Definition at line 118 of file ZipOutputStream.cs. |
|
Definition at line 203 of file ZipOutputStream.cs. |