forked from RipcordSoftware/libhttpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgzip_response_stream.h
More file actions
43 lines (28 loc) · 964 Bytes
/
Copy pathgzip_response_stream.h
File metadata and controls
43 lines (28 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef RS_LIBHTTPSERVER_GZIP_RESPONSE_STREAM_H
#define RS_LIBHTTPSERVER_GZIP_RESPONSE_STREAM_H
#include <string.h>
#include <boost/noncopyable.hpp>
#include <zlib.h>
#include "stream.h"
#include "exceptions.h"
namespace rs {
namespace httpserver {
class GzipResponseStream final : public Stream, private boost::noncopyable {
public:
GzipResponseStream(Stream& stream);
~GzipResponseStream();
virtual void Flush() override;
virtual int Read(byte* buffer, int offset, int count, bool peek = false) override {
throw InvalidStreamOperationException();
}
virtual int Write(const byte* buffer, int offset, int count) override;
virtual long getPosition() override { return position_; }
virtual long getLength() override { return length_; }
private:
Stream& stream_;
long position_;
long length_;
::z_stream zStream_;
};
}}
#endif /* RS_LIBHTTPSERVER_GZIP_RESPONSE_STREAM_H */