modules/libjar/zipwriter/nsZipDataStream.h
author David Major <dmajor@mozilla.com>
Wed, 03 Sep 2014 10:34:05 +1200
changeset 203292 d45a41039ece71eaafb0e2cdbbf385b80369e884
parent 197947 5466eb0ecd3b34a2af6877b0c508e96f58e5b20d
child 234933 ac4464790ec4896a5188fa50cfc69ae0ffeddc08
permissions -rw-r--r--
Bug 1061335 - Part 2: Add in-tree mozconfigs for VS2013 (these are not yet active) r=glandium

/* 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/.
 */

#ifndef _nsZipDataStream_h_
#define _nsZipDataStream_h_

#include "nsZipWriter.h"
#include "nsIOutputStream.h"
#include "nsIStreamListener.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"

class nsZipDataStream MOZ_FINAL : public nsIStreamListener
{
public:
    NS_DECL_THREADSAFE_ISUPPORTS
    NS_DECL_NSIREQUESTOBSERVER
    NS_DECL_NSISTREAMLISTENER

    nsZipDataStream()
    {
    }

    nsresult Init(nsZipWriter *aWriter, nsIOutputStream *aStream,
                  nsZipHeader *aHeader, int32_t aCompression);

    nsresult ReadStream(nsIInputStream *aStream);

private:

    ~nsZipDataStream() {}

    nsCOMPtr<nsIStreamListener> mOutput;
    nsCOMPtr<nsIOutputStream> mStream;
    nsRefPtr<nsZipWriter> mWriter;
    nsRefPtr<nsZipHeader> mHeader;

    nsresult CompleteEntry();
    nsresult ProcessData(nsIRequest *aRequest, nsISupports *aContext,
                         char *aBuffer, uint64_t aOffset, uint32_t aCount);
};

#endif