2013-03-27 20:31:26 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-10-02 18:19:11 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2013-11-18 18:34:00 -08:00
|
|
|
#ifndef nsGZFileWriter_h
|
|
|
|
#define nsGZFileWriter_h
|
|
|
|
|
2012-10-02 18:19:11 -07:00
|
|
|
#include "nsIGZFileWriter.h"
|
|
|
|
#include "zlib.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A simple class for writing .gz files.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
class nsGZFileWriter final : public nsIGZFileWriter
|
2012-10-02 18:19:11 -07:00
|
|
|
{
|
2014-06-30 15:11:53 -07:00
|
|
|
virtual ~nsGZFileWriter();
|
|
|
|
|
2012-10-02 18:19:11 -07:00
|
|
|
public:
|
|
|
|
nsGZFileWriter();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIGZFILEWRITER
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nsIGZFileWriter exposes two non-virtual overloads of Write(). We
|
|
|
|
* duplicate them here so that you can call these overloads on a pointer to
|
|
|
|
* the concrete nsGZFileWriter class.
|
|
|
|
*/
|
|
|
|
nsresult Write(const char* aStr)
|
|
|
|
{
|
|
|
|
return nsIGZFileWriter::Write(aStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult Write(const char* aStr, uint32_t aLen)
|
|
|
|
{
|
|
|
|
return nsIGZFileWriter::Write(aStr, aLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mInitialized;
|
|
|
|
bool mFinished;
|
|
|
|
gzFile mGZFile;
|
|
|
|
};
|
2013-11-18 18:34:00 -08:00
|
|
|
|
|
|
|
#endif
|