Move ZlibDecompressor to libshared

* This will be used to implement compressed http streams
* Remove the custom BDataOutput class, and use BDataIO instead, for
easier integration with existing code.
This commit is contained in:
Adrien Destugues
2014-02-11 12:06:38 +01:00
parent 9f11100be5
commit 9af2105d36
37 changed files with 131 additions and 148 deletions
@@ -0,0 +1,23 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PRIVATE__ZLIB_COMPRESSION_BASE_H_
#define _PRIVATE__ZLIB_COMPRESSION_BASE_H_
#include <SupportDefs.h>
namespace BPrivate {
class ZlibCompressionBase {
public:
static status_t TranslateZlibError(int error);
};
} // namespace BPrivate
#endif // _PRIVATE__ZLIB_COMPRESSION_BASE_H_
+45
View File
@@ -0,0 +1,45 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _PRIVATE__ZLIB_DECOMPRESSOR_H_
#define _PRIVATE__ZLIB_DECOMPRESSOR_H_
#include <zlib.h>
#include <ZlibCompressionBase.h>
class BDataIO;
namespace BPrivate {
class ZlibDecompressor : public ZlibCompressionBase {
public:
ZlibDecompressor(BDataIO* output);
~ZlibDecompressor();
status_t Init();
status_t DecompressNext(const void* input,
size_t inputSize);
status_t Finish();
static status_t DecompressSingleBuffer(const void* input,
size_t inputSize, void* output,
size_t outputSize,
size_t& _uncompressedSize);
private:
z_stream fStream;
BDataIO* fOutput;
bool fStreamInitialized;
bool fFinished;
};
} // namespace BPrivate
#endif // _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_