diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-06 22:44:32 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-06 22:44:32 +0700 |
commit | 44844b4c0e0df30a72f1659b9904749f456f2545 (patch) | |
tree | d727163d1ff7d8126c640b4263aed0f041de1e8e /crypto/src/util/io/compression/Zip.cs | |
parent | Use Id instead of ToString (diff) | |
download | BouncyCastle.NET-ed25519-44844b4c0e0df30a72f1659b9904749f456f2545.tar.xz |
Support leaveOpen in decompressors
Diffstat (limited to '')
-rw-r--r-- | crypto/src/util/io/compression/Zip.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/src/util/io/compression/Zip.cs b/crypto/src/util/io/compression/Zip.cs index f2773d63b..e5907c60d 100644 --- a/crypto/src/util/io/compression/Zip.cs +++ b/crypto/src/util/io/compression/Zip.cs @@ -21,12 +21,14 @@ namespace Org.BouncyCastle.Utilities.IO.Compression #endif } - internal static Stream DecompressInput(Stream stream) + internal static Stream DecompressInput(Stream stream, bool leaveOpen = false) { #if NET6_0_OR_GREATER - return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen: false); + return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen); #else - return new ZInputStream(stream, true); + return leaveOpen + ? new ZInputStreamLeaveOpen(stream, true) + : new ZInputStream(stream, true); #endif } } |