adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.27k stars 480 forks source link

whether&when to dispose OutputStream #134

Closed Supegg closed 8 years ago

Supegg commented 8 years ago

i think the caller decides whether&when to dispose outputstream. so, i suggest public TarWriter(Stream destination, CompressionInfo compressionInfo, bool closeStream = true) : base(ArchiveType.Tar) public GZipWriter(Stream destination, bool closeStream = true) : base(ArchiveType.GZip) public ZipWriter(Stream destination, CompressionInfo compressionInfo, string zipComment, bool closeStream = true) : base(ArchiveType.Zip)

PS: why? OutputStream.Dispose(); // required when bzip2 compression is used

adamhathcock commented 8 years ago

You're saying you want the option for sharpcompress to close the stream for you?

Supegg commented 8 years ago

when destination is a filestream, it is ok. Sometimes destination is a MemoryStream, it will pass to a method for use. If closed after tar, it doesn't work.

adamhathcock commented 8 years ago

You're right. I'm fixing this now: https://github.com/adamhathcock/sharpcompress/pull/138