4 #include "zipios++/zipios-config.h"
7 #include "zipios++/meta-iostreams.h"
25 void GZIPOutputStreambuf::setFilename(
const string &filename ) {
26 _filename = filename ;
29 void GZIPOutputStreambuf::setComment(
const string &comment ) {
51 int GZIPOutputStreambuf::overflow(
int c ) {
56 return DeflateOutputStreambuf::overflow( c ) ;
59 int GZIPOutputStreambuf::sync() {
60 return DeflateOutputStreambuf::sync() ;
63 void GZIPOutputStreambuf::writeHeader() {
64 unsigned char flg = 0x00;
65 flg |= (_filename ==
"") ? 0x00 : 0x08;
66 flg |= (_comment ==
"") ? 0x00 : 0x10;
68 ostream os( _outbuf ) ;
69 os << (
unsigned char)0x1f;
70 os << (
unsigned char)0x8b;
71 os << (
unsigned char)0x08;
73 os << (
unsigned char)0x00;
74 os << (
unsigned char)0x00;
75 os << (
unsigned char)0x00;
76 os << (
unsigned char)0x00;
77 os << (
unsigned char)0x00;
78 os << (
unsigned char)0x00;
80 if (_filename !=
"") {
81 os << _filename.c_str();
82 os << (
unsigned char)0x00;
86 os << _comment.c_str();
87 os << (
unsigned char)0x00;
91 void GZIPOutputStreambuf::writeTrailer() {
96 void GZIPOutputStreambuf::writeInt(uint32 i) {
97 ostream os( _outbuf ) ;
98 os << (
unsigned char)( i & 0xFF);
99 os << (
unsigned char)((i >> 8) & 0xFF);
100 os << (
unsigned char)((i >> 16) & 0xFF);
101 os << (
unsigned char)((i >> 24) & 0xFF);
DeflateOutputStreambuf is an output stream filter, that deflates the data that is written to it befor...
uint32 getCrc32() const
Returns the CRC32 for the current stream.
uint32 getCount() const
Returns the number of bytes written to the streambuf, that has been processed from the input buffer b...
void finish()
Finishes the compression.
void close()
Calls finish.
GZIPOutputStreambuf(streambuf *outbuf, bool del_outbuf=false)
GZIPOutputStreambuf constructor.
virtual ~GZIPOutputStreambuf()
Destructor.
Header file that defines ZipOutputStreambuf.