2014-05-05 21:30:43 +04: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: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
#ifndef nsBinaryStream_h___
|
|
|
|
#define nsBinaryStream_h___
|
|
|
|
|
1999-11-16 22:12:41 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2002-11-14 21:16:31 +03:00
|
|
|
#include "nsAString.h"
|
2001-07-31 23:05:34 +04:00
|
|
|
#include "nsIObjectInputStream.h"
|
|
|
|
#include "nsIObjectOutputStream.h"
|
|
|
|
#include "nsIStreamBufferAccess.h"
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2003-03-14 00:23:18 +03:00
|
|
|
#define NS_BINARYOUTPUTSTREAM_CID \
|
|
|
|
{ /* 86c37b9a-74e7-4672-844e-6e7dd83ba484 */ \
|
|
|
|
0x86c37b9a, \
|
|
|
|
0x74e7, \
|
|
|
|
0x4672, \
|
|
|
|
{0x84, 0x4e, 0x6e, 0x7d, 0xd8, 0x3b, 0xa4, 0x84} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_BINARYOUTPUTSTREAM_CONTRACTID "@mozilla.org/binaryoutputstream;1"
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
// Derive from nsIObjectOutputStream so this class can be used as a superclass
|
|
|
|
// by nsObjectOutputStream.
|
2014-08-05 21:33:55 +04:00
|
|
|
class nsBinaryOutputStream MOZ_FINAL : public nsIObjectOutputStream
|
1999-11-16 22:12:41 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-05-15 00:15:46 +04:00
|
|
|
nsBinaryOutputStream()
|
|
|
|
{
|
|
|
|
}
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
protected:
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsISupports methods
|
|
|
|
NS_DECL_ISUPPORTS
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIOutputStream methods
|
|
|
|
NS_DECL_NSIOUTPUTSTREAM
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIBinaryOutputStream methods
|
|
|
|
NS_DECL_NSIBINARYOUTPUTSTREAM
|
1999-11-21 11:01:08 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIObjectOutputStream methods
|
|
|
|
NS_DECL_NSIOBJECTOUTPUTSTREAM
|
2001-07-31 23:05:34 +04:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// Call Write(), ensuring that all proffered data is written
|
2014-05-15 00:15:46 +04:00
|
|
|
nsresult WriteFully(const char* aBuf, uint32_t aCount);
|
1999-11-21 11:01:08 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
nsCOMPtr<nsIOutputStream> mOutputStream;
|
|
|
|
nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
|
2014-07-01 02:11:53 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// virtual dtor since subclasses call our Release()
|
|
|
|
virtual ~nsBinaryOutputStream()
|
|
|
|
{
|
|
|
|
}
|
1999-11-16 22:12:41 +03:00
|
|
|
};
|
|
|
|
|
2003-03-14 00:23:18 +03:00
|
|
|
#define NS_BINARYINPUTSTREAM_CID \
|
2014-05-05 21:30:43 +04:00
|
|
|
{ /* c521a612-2aad-46db-b6ab-3b821fb150b1 */ \
|
|
|
|
0xc521a612, \
|
|
|
|
0x2aad, \
|
|
|
|
0x46db, \
|
|
|
|
{0xb6, 0xab, 0x3b, 0x82, 0x1f, 0xb1, 0x50, 0xb1} \
|
2003-03-14 00:23:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_BINARYINPUTSTREAM_CONTRACTID "@mozilla.org/binaryinputstream;1"
|
|
|
|
|
2014-08-05 21:33:55 +04:00
|
|
|
class nsBinaryInputStream MOZ_FINAL : public nsIObjectInputStream
|
1999-11-16 22:12:41 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-05-15 00:15:46 +04:00
|
|
|
nsBinaryInputStream()
|
|
|
|
{
|
|
|
|
}
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
protected:
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsISupports methods
|
|
|
|
NS_DECL_ISUPPORTS
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIInputStream methods
|
|
|
|
NS_DECL_NSIINPUTSTREAM
|
1999-11-16 22:12:41 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIBinaryInputStream methods
|
|
|
|
NS_DECL_NSIBINARYINPUTSTREAM
|
2001-07-31 23:05:34 +04:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIObjectInputStream methods
|
|
|
|
NS_DECL_NSIOBJECTINPUTSTREAM
|
2001-07-31 23:05:34 +04:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
nsCOMPtr<nsIInputStream> mInputStream;
|
|
|
|
nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
|
2014-07-01 02:11:53 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// virtual dtor since subclasses call our Release()
|
|
|
|
virtual ~nsBinaryInputStream()
|
|
|
|
{
|
|
|
|
}
|
1999-11-16 22:12:41 +03:00
|
|
|
};
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
#endif // nsBinaryStream_h___
|