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

ssh - Vagrant Windows - ssh_exchange_identification: read: Connection reset by peer -

gcc - Neither ld wrap nor LD_PRELOAD working to intercept system call -

maven - jacoco coverage per test setup -