mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 07:54:39 +00:00
Explicit finish for BZip2 writing
This commit is contained in:
@@ -27,6 +27,11 @@ namespace SharpCompress.Compressor.BZip2
|
||||
this.stream = new CBZip2InputStream(stream, decompressContacted, leaveOpen);
|
||||
}
|
||||
}
|
||||
|
||||
public void Finish()
|
||||
{
|
||||
(this.stream as CBZip2OutputStream)?.Finish();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace SharpCompress.Reader
|
||||
if (BZip2Stream.IsBZip2(rewindableStream))
|
||||
{
|
||||
rewindableStream.Rewind(false);
|
||||
BZip2Stream testStream = new BZip2Stream(rewindableStream, CompressionMode.Decompress, false);
|
||||
BZip2Stream testStream = new BZip2Stream(rewindableStream, CompressionMode.Decompress, true);
|
||||
if (TarArchive.IsTarFile(testStream))
|
||||
{
|
||||
rewindableStream.Rewind(true);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SharpCompress.Writer.Tar
|
||||
throw new InvalidFormatException("Tar does not support compression: " + compressionInfo.Type);
|
||||
}
|
||||
}
|
||||
InitalizeStream(destination, false);
|
||||
InitalizeStream(destination, !leaveOpen);
|
||||
}
|
||||
|
||||
public override void Write(string filename, Stream source, DateTime? modificationTime)
|
||||
@@ -91,7 +91,7 @@ namespace SharpCompress.Writer.Tar
|
||||
{
|
||||
PadTo512(0, true);
|
||||
PadTo512(0, true);
|
||||
OutputStream.Dispose(); // required when bzip2 compression is used
|
||||
(OutputStream as BZip2Stream)?.Finish(); // required when bzip2 compression is used
|
||||
}
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user