-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
91 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,47 @@ | ||
namespace Zaabee.LZ4; | ||
|
||
public sealed class Lz4Compressor : ICompressor | ||
public sealed class Lz4Compressor( | ||
LZ4Level level = Lz4Helper.Level, | ||
int extraMemory = Lz4Helper.ExtraMemory, | ||
bool interactive = Lz4Helper.Interactive, | ||
LZ4DecoderSettings? settings = Lz4Helper.Settings) | ||
: ICompressor | ||
{ | ||
private readonly LZ4Level _level; | ||
private readonly int _extraMemory; | ||
private readonly bool _interactive; | ||
private readonly LZ4DecoderSettings? _settings; | ||
|
||
public Lz4Compressor( | ||
LZ4Level level = Lz4Helper.Level, | ||
int extraMemory = Lz4Helper.ExtraMemory, | ||
bool interactive = Lz4Helper.Interactive, | ||
LZ4DecoderSettings? settings = Lz4Helper.Settings | ||
) | ||
{ | ||
_interactive = interactive; | ||
_settings = settings; | ||
_extraMemory = extraMemory; | ||
_level = level; | ||
} | ||
|
||
public ValueTask<MemoryStream> CompressAsync( | ||
Stream rawStream, | ||
CancellationToken cancellationToken = default | ||
) => rawStream.ToLz4Async(_level, _extraMemory, cancellationToken); | ||
) => rawStream.ToLz4Async(level, extraMemory, cancellationToken); | ||
|
||
public ValueTask<MemoryStream> DecompressAsync( | ||
Stream compressedStream, | ||
CancellationToken cancellationToken = default | ||
) => compressedStream.UnLz4Async(_settings, _interactive, cancellationToken); | ||
) => compressedStream.UnLz4Async(settings, interactive, cancellationToken); | ||
|
||
public ValueTask CompressAsync( | ||
Stream inputStream, | ||
Stream outputStream, | ||
CancellationToken cancellationToken = default | ||
) => inputStream.ToLz4Async(outputStream, _level, _extraMemory, cancellationToken); | ||
) => inputStream.ToLz4Async(outputStream, level, extraMemory, cancellationToken); | ||
|
||
public ValueTask DecompressAsync( | ||
Stream inputStream, | ||
Stream outputStream, | ||
CancellationToken cancellationToken = default | ||
) => inputStream.UnLz4Async(outputStream, _settings, _interactive, cancellationToken); | ||
) => inputStream.UnLz4Async(outputStream, settings, interactive, cancellationToken); | ||
|
||
public byte[] Compress(byte[] rawBytes) => rawBytes.ToLz4(_level, _extraMemory); | ||
public byte[] Compress(byte[] rawBytes) => rawBytes.ToLz4(level, extraMemory); | ||
|
||
public byte[] Decompress(byte[] compressedBytes) => | ||
compressedBytes.UnLz4(_settings, _interactive); | ||
compressedBytes.UnLz4(settings, interactive); | ||
|
||
public MemoryStream Compress(Stream rawStream) => rawStream.ToLz4(_level, _extraMemory); | ||
public MemoryStream Compress(Stream rawStream) => rawStream.ToLz4(level, extraMemory); | ||
|
||
public MemoryStream Decompress(Stream compressedStream) => | ||
compressedStream.UnLz4(_settings, _interactive); | ||
compressedStream.UnLz4(settings, interactive); | ||
|
||
public void Compress(Stream inputStream, Stream outputStream) => | ||
inputStream.ToLz4(outputStream, _level, _extraMemory); | ||
inputStream.ToLz4(outputStream, level, extraMemory); | ||
|
||
public void Decompress(Stream inputStream, Stream outputStream) => | ||
inputStream.UnLz4(outputStream, _settings, _interactive); | ||
inputStream.UnLz4(outputStream, settings, interactive); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Zaabee.SharpZipLib; | ||
|
||
public static partial class Bzip2Helper | ||
{ | ||
internal const int BlockSize = 9; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Zaabee.SharpZipLib; | ||
|
||
public static partial class DeflateHelper | ||
{ | ||
internal const Deflater? Deflater = null; | ||
internal const int BufferSize = 512; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.