mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
whether&when to dispose OutputStream #91
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Supegg on GitHub (Mar 3, 2016).
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 on GitHub (Mar 30, 2016):
You're saying you want the option for sharpcompress to close the stream for you?
@Supegg commented on GitHub (Mar 31, 2016):
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 on GitHub (Mar 31, 2016):
You're right. I'm fixing this now: https://github.com/adamhathcock/sharpcompress/pull/138