diff --git a/CHANGELOG.md b/CHANGELOG.md index bc68fb3f..a0360d2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- Support for ZLIB compression via the [System.IO.Compression](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression) API for .NET 6, 7, 8 and 9 + ## [3.5.0] - 2024-11-18 ### Added diff --git a/benchmarks/Compression/Compression.csproj b/benchmarks/Compression/Compression.csproj index 75bd08e8..7e53a1f2 100644 --- a/benchmarks/Compression/Compression.csproj +++ b/benchmarks/Compression/Compression.csproj @@ -11,7 +11,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/DotPulsar/Internal/Compression/BuiltinZlibCompression.cs b/src/DotPulsar/Internal/Compression/BuiltinZlibCompression.cs index d1b3cc64..a1176183 100644 --- a/src/DotPulsar/Internal/Compression/BuiltinZlibCompression.cs +++ b/src/DotPulsar/Internal/Compression/BuiltinZlibCompression.cs @@ -57,7 +57,7 @@ private static Func, ReadOnlySequence> CreateCompre { using var dataStream = new MemoryStream(data.ToArray()); using var compressedStream = new MemoryStream(); - using var compressor = (Stream) Activator.CreateInstance(zlibStreamType!, new object[] { compressedStream, compressionLevelOptimal! })!; + using var compressor = (Stream) Activator.CreateInstance(zlibStreamType!, [compressedStream, compressionLevelOptimal!])!; dataStream.CopyTo(compressor); compressor.Close(); return new ReadOnlySequence(compressedStream.ToArray()); @@ -68,7 +68,7 @@ private static Func, int, ReadOnlySequence> CreateD { using var dataStream = new MemoryStream(data.ToArray()); using var decompressedStream = new MemoryStream(); - using var decompressor = (Stream) Activator.CreateInstance(zlibStreamType!, new object[] { dataStream, compressionModeDecompress! })!; + using var decompressor = (Stream) Activator.CreateInstance(zlibStreamType!, [dataStream, compressionModeDecompress!])!; decompressor.CopyTo(decompressedStream); decompressor.Close(); decompressedStream.Position = 0; diff --git a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj index da2e2d01..82327d9c 100644 --- a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj +++ b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj @@ -19,7 +19,7 @@ - +