IonKiwi.lz4.managed
1.0.7
dotnet add package IonKiwi.lz4.managed --version 1.0.7
NuGet\Install-Package IonKiwi.lz4.managed -Version 1.0.7
<PackageReference Include="IonKiwi.lz4.managed" Version="1.0.7" />
paket add IonKiwi.lz4.managed --version 1.0.7
#r "nuget: IonKiwi.lz4.managed, 1.0.7"
// Install IonKiwi.lz4.managed as a Cake Addin #addin nuget:?package=IonKiwi.lz4.managed&version=1.0.7 // Install IonKiwi.lz4.managed as a Cake Tool #tool nuget:?package=IonKiwi.lz4.managed&version=1.0.7
LZ4 for .NET (original C sources translated to C#)
LZ4 has been written by Yann Collet and the original sources can be found on https://github.com/lz4/lz4
This project contains the translated C# sources
How to use
non-streaming
Non streaming version, works with managed byte arrays, uses the LZ4 Framing Format (v1.6.2).
The compressed data that this stream creates is readable by the lz4 command line tools.
The Compress function has additional parameters to control the result.
- blockMode: Linked or Independent blocks
- blockSize: 64KB / 256KB / 1MB / 4MB
- checksumMode: None / Content / Block
- maxFrameSize: optional maximum frame size
- highCompression: use lz4hc mode
Example:
// compress data
byte[] dataToCompress = ...
byte[] compressedData = LZ4Utility.Compress(dataToCompress);
// decompress data
byte[] decompressedData = LZ4Utility.Decompress(compressedData);
streaming
Streaming version, uses the LZ4 Framing Format (v1.6.2).
The compressed data that this stream creates is readable by the lz4 command line tools.
Example:
// compress data [with content checksum]
using (LZ4Stream stream = LZ4Stream.CreateCompressor(innerStream, LZ4StreamMode.Write, LZ4FrameBlockMode.Linked, LZ4FrameBlockSize.Max64KB, LZ4FrameChecksumMode.Content)) {
// write uncompressed data to the lz4 stream
// the stream will compress the data and write it to the innerStream
stream.Write(buffer, 0, buffer.Length);
}
// compress data [with block and content checksum, start a new frame after 100 data blocks]
// note: the lz4 command line tools do NOT support block checksums currently
using (LZ4Stream stream = LZ4Stream.CreateCompressor(innerStream, LZ4StreamMode.Write, LZ4FrameBlockMode.Linked, LZ4FrameBlockSize.Max64KB, LZ4FrameChecksumMode.Block | LZ4FrameChecksumMode.Content, 100)) {
// write uncompressed data to the lz4 stream
// the stream will compress the data and write it to the innerStream
stream.Write(buffer, 0, buffer.Length);
}
// decompress data (in read mode)
using (LZ4Stream stream = LZ4Stream.CreateDecompressor(innerStream, LZ4StreamMode.Read)) {
// the lz4 stream will read the compressed data from the innerStream
// and return the uncompressed data in 'buffer'
int bytesRead = stream.Read(buffer, 0, buffer.Length);
}
// decompress data (in write mode)
using (LZ4Stream stream = LZ4Stream.CreateDecompressor(innerStream, LZ4StreamMode.Write)) {
// the lz4 stream will decompress the data from 'buffer'
// and write the uncompressed data to the 'innerStream'
stream.Write(buffer, 0, buffer.Length);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Buffers (>= 4.5.1)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
.NETStandard 2.1
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IonKiwi.lz4.managed:
Package | Downloads |
---|---|
dbx-sql-csharp
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.0.6
translated lz4 1.9.4
for .net 6 use intrinsics
- BitOperations.TrailingZeroCount
- BitOperations.RotateLeft
- BinaryPrimitives.ReverseEndianness
v1.0.7
- handle empty blocks
- remove System.Runtime.CompilerServices.Unsafe dependency from .net6 target