public virtual void CopyToStream(Stream fstgt) { FileStream fssrc = File.OpenRead(sourcePath); try { fssrc.Seek(this.Start, SeekOrigin.Begin); if (compressed) { fstgt = new ComponentAce.Compression.Libs.zlib.ZOutputStream(fstgt); } StreamUtils.CopyFromStreamToStream(fssrc, fstgt, this.length); } finally { fssrc.Close(); } }
public override void CopyToStream(Stream fstgt) { using (FileStream fs = File.OpenRead(sourcePath)) { fs.Seek(offset, SeekOrigin.Begin); ZipInputStream zs = new ZipInputStream(fs); ZipEntry ze; int index = 0; while ((ze = zs.GetNextEntry()) != null) { if (itemIndex == index) { StreamUtils.CopyFromStreamToStream(zs, fstgt, ze.Size); return; } index++; } } }