2 * Copyright 2017, Jérôme Duval.
3 * Copyright 2014, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
6 #ifndef _ZSTD_COMPRESSION_ALGORITHM_H_
7 #define _ZSTD_COMPRESSION_ALGORITHM_H_
10 #include <CompressionAlgorithm.h>
15 B_ZSTD_COMPRESSION_NONE
= 0,
16 B_ZSTD_COMPRESSION_FASTEST
= 1,
17 B_ZSTD_COMPRESSION_BEST
= 19,
18 B_ZSTD_COMPRESSION_DEFAULT
= 2,
22 class BZstdCompressionParameters
: public BCompressionParameters
{
24 BZstdCompressionParameters(
26 = B_ZSTD_COMPRESSION_DEFAULT
);
27 virtual ~BZstdCompressionParameters();
29 int32
CompressionLevel() const;
30 void SetCompressionLevel(int32 level
);
32 size_t BufferSize() const;
33 void SetBufferSize(size_t size
);
36 int32 fCompressionLevel
;
41 class BZstdDecompressionParameters
: public BDecompressionParameters
{
43 BZstdDecompressionParameters();
44 virtual ~BZstdDecompressionParameters();
46 size_t BufferSize() const;
47 void SetBufferSize(size_t size
);
54 class BZstdCompressionAlgorithm
: public BCompressionAlgorithm
{
56 BZstdCompressionAlgorithm();
57 virtual ~BZstdCompressionAlgorithm();
59 virtual status_t
CreateCompressingInputStream(BDataIO
* input
,
60 const BCompressionParameters
* parameters
,
62 virtual status_t
CreateCompressingOutputStream(BDataIO
* output
,
63 const BCompressionParameters
* parameters
,
65 virtual status_t
CreateDecompressingInputStream(BDataIO
* input
,
66 const BDecompressionParameters
* parameters
,
68 virtual status_t
CreateDecompressingOutputStream(BDataIO
* output
,
69 const BDecompressionParameters
* parameters
,
72 virtual status_t
CompressBuffer(const void* input
,
73 size_t inputSize
, void* output
,
74 size_t outputSize
, size_t& _compressedSize
,
75 const BCompressionParameters
* parameters
77 virtual status_t
DecompressBuffer(const void* input
,
78 size_t inputSize
, void* output
,
80 size_t& _uncompressedSize
,
81 const BDecompressionParameters
* parameters
85 struct CompressionStrategy
;
86 struct DecompressionStrategy
;
88 template<typename BaseClass
, typename Strategy
, typename StreamType
> struct Stream
;
89 template<typename BaseClass
, typename Strategy
, typename StreamType
>
93 static status_t
_TranslateZstdError(size_t error
);
97 #endif // _ZSTD_COMPRESSION_ALGORITHM_H_