ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/Zlib/GzipWriter.cpp
Revision: 697
Committed: 2006-03-10T04:17:42-08:00 (19 years, 3 months ago) by douglas
File size: 546 byte(s)
Log Message:
No worky!

File Contents

# Content
1 // Zlib Gzip Writer
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #include <cxx/standard.hh>
8
9 #include "GzipWriter.hpp"
10
11 namespace Zlib
12 {
13
14 GzipWriter::GzipWriter(const cse::String &path) : file(CheckError(::gzopen(path.NullTerminate(), "wb")))
15 {
16 }
17
18 GzipWriter::~GzipWriter()
19 {
20 CheckError(::gzclose(file), file);
21 }
22
23 size_t GzipWriter::Write(const byte_t *data, size_t length)
24 {
25 int size(::gzwrite(file, data, length));
26
27 if (size == -1)
28 throw Error(file);
29
30 return size;
31 }
32
33 void GzipWriter::Flush()
34 {
35 CheckError(::gzflush(file, Z_SYNC_FLUSH), file);
36 }
37
38 }

Properties

Name Value
svn:eol-style native
svn:keywords Id