C# ZipArchiveEntry Open
Description
ZipArchiveEntry Open
Opens the entry from the zip archive.
Syntax
ZipArchiveEntry.Open
has the following syntax.
public Stream Open()
Returns
ZipArchiveEntry.Open
method returns The stream that represents the contents of the entry.
Example
The following example shows how to create a new entry, open it with the Open method, and write to the stream.
using System;//from ww w . ja va 2 s . c om
using System.IO;
using System.IO.Compression;
class Program
{
static void Main(string[] args)
{
using (FileStream zipToOpen = new FileStream(@"c:\users\exampleuser\release.zip", FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
ZipArchiveEntry readmeEntry = archive.CreateEntry("Readme.txt");
using (StreamWriter writer = new StreamWriter(readmeEntry.Open()))
{
writer.WriteLine("Information about this package.");
}
}
}
}
}