ICSharpCode.SharpZipLib.Zip.MemoryArchiveStorage.OpenForDirectUpdate C# (CSharp) Method

OpenForDirectUpdate() public method

Return a stream suitable for performing direct updates on the original source.
If the stream passed is not null this is used; otherwise a new MemoryStream is returned.
public OpenForDirectUpdate ( Stream stream ) : Stream
stream Stream The original source stream
return Stream
        public override Stream OpenForDirectUpdate(Stream stream) {
            Stream result;
            if ((stream==null)||!stream.CanWrite) {
                result=new MemoryStream();

                if (stream!=null) {
                    stream.Position=0;
                    StreamUtils.Copy(stream, result, new byte[4096]);

                    stream.Dispose();
                }
            } else {
                result=stream;
            }

            return result;
        }