ICSharpCode.SharpZipLib.Zip.ZipFile.GetInputStream C# (CSharp) Method

GetInputStream() public method

Gets an input stream for reading the given zip entry data in an uncompressed form. Normally the ZipEntry should be an entry returned by GetEntry().
/// The ZipFile has already been closed /// /// The compression method for the entry is unknown /// /// The entry is not found in the ZipFile ///
public GetInputStream ( ZipEntry entry ) : Stream
entry ZipEntry The to obtain a data for
return Stream
        public Stream GetInputStream(ZipEntry entry) {
            if (entry==null) {
                throw new ArgumentNullException("entry");
            }

            if (isDisposed_) {
                throw new ObjectDisposedException("ZipFile");
            }

            long index=entry.ZipFileIndex;
            if ((index<0)||(index>=entries_.Length)||(entries_[index].Name!=entry.Name)) {
                index=FindEntry(entry.Name, true);
                if (index<0) {
                    throw new ZipException("Entry cannot be found");
                }
            }
            return GetInputStream(index);
        }

Same methods

ZipFile::GetInputStream ( long entryIndex ) : Stream

Usage Example

Example #1
0
        public void Convert(EndianBinaryWriter writer)
        {
            var jbtWriter = new JbtWriter(writer);

            var zf = new ZipFile(jarFile);

            foreach (ZipEntry ze in zf)
            {
                if (!ze.IsFile) continue;
                if (!ze.Name.EndsWith(".class")) continue;

                var type = new CompileTypeInfo();

                type.Read(zf.GetInputStream(ze));

                var reader = new BinaryReader(zf.GetInputStream(ze));

                var buffer = new byte[ze.Size];
                reader.Read(buffer, 0, (int)ze.Size);

                jbtWriter.Write(type.Name, buffer);
            }

            jbtWriter.Flush();
        }
All Usage Examples Of ICSharpCode.SharpZipLib.Zip.ZipFile::GetInputStream