ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/GzipWriter.cpp
Revision: 674
Committed: 2006-03-02T23:47:54-08:00 (19 years, 3 months ago) by douglas
File size: 492 byte(s)
Log Message:
Woo!

File Contents

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

Properties

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