Read() public static method

Reads one entry from the zip directory structure in the zip file.
public static Read ( System s ) : ZipDirEntry
s System the stream from which to read.
return ZipDirEntry
Beispiel #1
0
        private static void ReadIntoInstance(ZipFile zf)
        {
            zf._entries = new System.Collections.Generic.List <ZipEntry>();
            ZipEntry e;

            if (zf.Verbose)
            {
                zf.Output.WriteLine("Reading zip {0}...", zf.Name);
            }

            while ((e = ZipEntry.Read(zf.ReadStream)) != null)
            {
                if (zf.Verbose)
                {
                    zf.Output.WriteLine("  {0}", e.FileName);
                }

                if (zf._Debug)
                {
                    System.Console.WriteLine("  ZipFile::Read(): ZipEntry: {0}", e.FileName);
                }

                zf._entries.Add(e);
            }

            // read the zipfile's central directory structure here.
            zf._direntries = new System.Collections.Generic.List <ZipDirEntry>();

            ZipDirEntry de;

            while ((de = ZipDirEntry.Read(zf.ReadStream)) != null)
            {
                if (zf._Debug)
                {
                    System.Console.WriteLine("  ZipFile::Read(): ZipDirEntry: {0}", de.FileName);
                }
                zf._direntries.Add(de);
            }

            // when finished slurping in the zip, close the read stream
            zf.ReadStream.Close();
            zf.ReadStream = null;
        }