C# Class ICSharpCode.SharpZipLib.Zip.ZipInputStream

This is an InflaterInputStream that reads the files baseInputStream an zip archive one after another. It has a special method to get the zip entry of the next file. The zip entry contains information about the file name size, compressed size, Crc, etc. It includes support for Stored and Deflated entries.

Author of the original java version : Jochen Hoenicke
Inheritance: ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream
Show file Open project: icsharpcode/SharpZipLib Class Usage Examples

Public Methods

Method Description
CloseEntry ( ) : void

Closes the current zip entry and moves to the next one.

GetNextEntry ( ) : ZipEntry

Advances to the next entry in the archive

If the previous entry is still open CloseEntry is called.

Read ( byte buffer, int offset, int count ) : int

Read a block of bytes from the stream.

Zero bytes read means end of stream.

ReadByte ( ) : int

Reads a byte from the current zip entry.

ZipInputStream ( Stream baseInputStream ) : System

Creates a new Zip input stream, for reading a zip archive.

ZipInputStream ( Stream baseInputStream, int bufferSize ) : System

Creates a new Zip input stream, for reading a zip archive.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Closes the zip input stream

Private Methods

Method Description
BodyRead ( byte buffer, int offset, int count ) : int

Reads a block of bytes from the current zip entry.

CompleteCloseEntry ( bool testCrc ) : void

Complete cleanup as the final part of closing.

InitialRead ( byte destination, int offset, int count ) : int

Perform the initial read on an entry which may include reading encryption headers and setting up inflation.

ReadDataDescriptor ( ) : void

Read data descriptor at the end of compressed data.

ReadingNotAvailable ( byte destination, int offset, int count ) : int

Handle attempts to read by throwing an InvalidOperationException.

ReadingNotSupported ( byte destination, int offset, int count ) : int

Handle attempts to read from this entry by throwing an exception

Method Details

CloseEntry() public method

Closes the current zip entry and moves to the next one.
/// The stream is closed /// /// The Zip stream ends early ///
public CloseEntry ( ) : void
return void

Dispose() protected method

Closes the zip input stream
protected Dispose ( bool disposing ) : void
disposing bool
return void

GetNextEntry() public method

Advances to the next entry in the archive
If the previous entry is still open CloseEntry is called.
/// Input stream is closed /// /// Password is not set, password is invalid, compression method is invalid, /// version required to extract is not supported ///
public GetNextEntry ( ) : ZipEntry
return ZipEntry

Read() public method

Read a block of bytes from the stream.
Zero bytes read means end of stream.
public Read ( byte buffer, int offset, int count ) : int
buffer byte The destination for the bytes.
offset int The index to start storing data.
count int The number of bytes to attempt to read.
return int

ReadByte() public method

Reads a byte from the current zip entry.
public ReadByte ( ) : int
return int

ZipInputStream() public method

Creates a new Zip input stream, for reading a zip archive.
public ZipInputStream ( Stream baseInputStream ) : System
baseInputStream Stream The underlying providing data.
return System

ZipInputStream() public method

Creates a new Zip input stream, for reading a zip archive.
public ZipInputStream ( Stream baseInputStream, int bufferSize ) : System
baseInputStream Stream The underlying providing data.
bufferSize int Size of the buffer.
return System