michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsBinaryStream_h___ michael@0: #define nsBinaryStream_h___ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsAString.h" michael@0: #include "nsIObjectInputStream.h" michael@0: #include "nsIObjectOutputStream.h" michael@0: #include "nsIStreamBufferAccess.h" michael@0: michael@0: #define NS_BINARYOUTPUTSTREAM_CID \ michael@0: { /* 86c37b9a-74e7-4672-844e-6e7dd83ba484 */ \ michael@0: 0x86c37b9a, \ michael@0: 0x74e7, \ michael@0: 0x4672, \ michael@0: {0x84, 0x4e, 0x6e, 0x7d, 0xd8, 0x3b, 0xa4, 0x84} \ michael@0: } michael@0: michael@0: #define NS_BINARYOUTPUTSTREAM_CONTRACTID "@mozilla.org/binaryoutputstream;1" michael@0: michael@0: // Derive from nsIObjectOutputStream so this class can be used as a superclass michael@0: // by nsObjectOutputStream. michael@0: class nsBinaryOutputStream : public nsIObjectOutputStream michael@0: { michael@0: public: michael@0: nsBinaryOutputStream() {} michael@0: // virtual dtor since subclasses call our Release() michael@0: virtual ~nsBinaryOutputStream() {} michael@0: michael@0: protected: michael@0: // nsISupports methods michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIOutputStream methods michael@0: NS_DECL_NSIOUTPUTSTREAM michael@0: michael@0: // nsIBinaryOutputStream methods michael@0: NS_DECL_NSIBINARYOUTPUTSTREAM michael@0: michael@0: // nsIObjectOutputStream methods michael@0: NS_DECL_NSIOBJECTOUTPUTSTREAM michael@0: michael@0: // Call Write(), ensuring that all proffered data is written michael@0: nsresult WriteFully(const char *aBuf, uint32_t aCount); michael@0: michael@0: nsCOMPtr mOutputStream; michael@0: nsCOMPtr mBufferAccess; michael@0: }; michael@0: michael@0: #define NS_BINARYINPUTSTREAM_CID \ michael@0: { /* c521a612-2aad-46db-b6ab-3b821fb150b1 */ \ michael@0: 0xc521a612, \ michael@0: 0x2aad, \ michael@0: 0x46db, \ michael@0: {0xb6, 0xab, 0x3b, 0x82, 0x1f, 0xb1, 0x50, 0xb1} \ michael@0: } michael@0: michael@0: #define NS_BINARYINPUTSTREAM_CONTRACTID "@mozilla.org/binaryinputstream;1" michael@0: michael@0: // Derive from nsIObjectInputStream so this class can be used as a superclass michael@0: // by nsObjectInputStream. michael@0: class nsBinaryInputStream : public nsIObjectInputStream michael@0: { michael@0: public: michael@0: nsBinaryInputStream() {} michael@0: // virtual dtor since subclasses call our Release() michael@0: virtual ~nsBinaryInputStream() {} michael@0: michael@0: protected: michael@0: // nsISupports methods michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIInputStream methods michael@0: NS_DECL_NSIINPUTSTREAM michael@0: michael@0: // nsIBinaryInputStream methods michael@0: NS_DECL_NSIBINARYINPUTSTREAM michael@0: michael@0: // nsIObjectInputStream methods michael@0: NS_DECL_NSIOBJECTINPUTSTREAM michael@0: michael@0: nsCOMPtr mInputStream; michael@0: nsCOMPtr mBufferAccess; michael@0: }; michael@0: michael@0: #endif // nsBinaryStream_h___