ZipInputStream Class

DotNetZip

Ionic Zip Library v1.9.1.6 ZipInputStream Class
ReferenceIonic.ZipZipInputStream
Provides a stream metaphor for reading zip files.
Declaration Syntax
C# Visual Basic Visual C++
public class ZipInputStream : Stream
Public Class ZipInputStream _
	Inherits Stream
public ref class ZipInputStream : public Stream
Members
All Members Constructors Methods Properties



Icon Member Description
ZipInputStream(Stream)
Create a ZipInputStream, wrapping it around an existing stream.

ZipInputStream(String)
Create a ZipInputStream, given the name of an existing zip file.

ZipInputStream(Stream, Boolean)
Create a ZipInputStream, explicitly specifying whether to keep the underlying stream open.

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 true.
(Overrides Stream.CanRead.)
CanSeek
Returns the value of CanSeek for the underlying (wrapped) stream.
(Overrides Stream.CanSeek.)
CanTimeout
Gets a value that determines whether the current stream can time out.
(Inherited from Stream.)
CanWrite
Always returns false.
(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 decompression.

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.)
Dispose(Boolean)
Dispose the stream.
(Overrides Stream.Dispose(Boolean).)
Dispose()()()()
Releases all resources used by the Stream.
(Inherited from Stream.)
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)
Determines whether the specified Object is equal to the current 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.)
GetNextEntry()()()()
Read the next entry from the zip file.

GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
InitializeLifetimeService()()()()
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Length
Returns the length of the underlying stream.
(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.)
Password
Sets the password to be used on the ZipInputStream instance.

Position
Gets or sets the position of the underlying stream.
(Overrides Stream.Position.)
ProvisionalAlternateEncoding
The text encoding to use when reading entries into the zip archive, for those entries whose filenames or comments cannot be encoded with the default (IBM437) encoding.

Read(array<Byte>[]()[][], Int32, Int32)
Read the data from the stream into the buffer.
(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 seeks in the underlying stream.
(Overrides Stream.Seek(Int64, SeekOrigin).)
SetLength(Int64)
This method always throws a NotSupportedException.
(Overrides Stream.SetLength(Int64).)
ToString()()()()
Provides a string representation of the instance.
(Overrides Object.ToString()()()().)
Write(array<Byte>[]()[][], Int32, Int32)
This method always throws a NotSupportedException.
(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.)
Remarks

This class provides an alternative programming model for reading zip files to the one enabled by the ZipFile class. Use this when reading zip files, as an alternative to the ZipFile class, when you would like to use a Stream class to read the file.

Some application designs require a readable stream for input. This stream can be used to read a zip file, and extract entries.

Both the ZipInputStream class and the ZipFile class can be used to read and extract zip files. Both of them support many of the common zip features, including Unicode, different compression levels, and ZIP64. The programming models differ. For example, when extracting entries via calls to the GetNextEntry() and Read() methods on the ZipInputStream class, the caller is responsible for creating the file, writing the bytes into the file, setting the attributes on the file, and setting the created, last modified, and last accessed timestamps on the file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the ZipInputStream is generally recommended for when your application wants to extract the data, without storing that data into a file.

Aside from the obvious differences in programming model, there are some differences in capability between the ZipFile class and the ZipInputStream class.

  • ZipFile can be used to create or update zip files, or read and extract zip files. ZipInputStream can be used only to read and extract zip files. If you want to use a stream to create zip files, check out the ZipOutputStream.
  • ZipInputStream cannot read segmented or spanned zip files.
  • ZipInputStream will not read Zip file comments.
  • When reading larger files, ZipInputStream will always underperform ZipFile. This is because the ZipInputStream does a full scan on the zip file, while the ZipFile class reads the central directory of the zip file.
Inheritance Hierarchy
Object
MarshalByRefObject
  Stream
    ZipInputStream

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