c# - Why the length of zipped stream is always 10? -


i testing code. stuck following. ever write text, length of zipped stream 10? doing wrong?

var instream = new memorystream();  var inwriter = new streamwriter(instream);  str text = "helloworldsasdfghj123455667880fgsjfhdfasdferrbvbyjun hbwecwcxqsz    edcrgvebrjnuj5juerqwetsrgfggshurhtnbvzkfjhguhgrgal;kjhao;rhl;zkfhg;aorihghg;oahrgarhguhh';aaeaeiaijeihjrhfidfhfidfidhh953453453"; inwriter.writeline(text);  inwriter.flush(); instream.position = 0;  var outstream = new memorystream(); var compressstream = new gzipstream(outstream, compressionmode.compress); instream.copyto(compressstream);  compressstream.flush(); outstream.flush(); compressstream.flush();  outstream.position = 0;  console.writeline(outstream.position); console.writeline(outstream.length); 

until close compression stream doesn't know you've finished writing - cannot complete compression algorithm. flushing flushes parts can flush, until been told have completed adding new bytes cannot flush last package of compressed data.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -