Bumping manifests a=b2g-bump
[gecko.git] / xpcom / io / nsBinaryStream.h
blobf9dfaa1e912f6402ca09a2f3ae4af1566c97c70c
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsBinaryStream_h___
8 #define nsBinaryStream_h___
10 #include "nsCOMPtr.h"
11 #include "nsAString.h"
12 #include "nsIObjectInputStream.h"
13 #include "nsIObjectOutputStream.h"
14 #include "nsIStreamBufferAccess.h"
16 #define NS_BINARYOUTPUTSTREAM_CID \
17 { /* 86c37b9a-74e7-4672-844e-6e7dd83ba484 */ \
18 0x86c37b9a, \
19 0x74e7, \
20 0x4672, \
21 {0x84, 0x4e, 0x6e, 0x7d, 0xd8, 0x3b, 0xa4, 0x84} \
24 #define NS_BINARYOUTPUTSTREAM_CONTRACTID "@mozilla.org/binaryoutputstream;1"
26 // Derive from nsIObjectOutputStream so this class can be used as a superclass
27 // by nsObjectOutputStream.
28 class nsBinaryOutputStream MOZ_FINAL : public nsIObjectOutputStream
30 public:
31 nsBinaryOutputStream()
35 protected:
36 // nsISupports methods
37 NS_DECL_ISUPPORTS
39 // nsIOutputStream methods
40 NS_DECL_NSIOUTPUTSTREAM
42 // nsIBinaryOutputStream methods
43 NS_DECL_NSIBINARYOUTPUTSTREAM
45 // nsIObjectOutputStream methods
46 NS_DECL_NSIOBJECTOUTPUTSTREAM
48 // Call Write(), ensuring that all proffered data is written
49 nsresult WriteFully(const char* aBuf, uint32_t aCount);
51 nsCOMPtr<nsIOutputStream> mOutputStream;
52 nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
54 private:
55 // virtual dtor since subclasses call our Release()
56 virtual ~nsBinaryOutputStream()
61 #define NS_BINARYINPUTSTREAM_CID \
62 { /* c521a612-2aad-46db-b6ab-3b821fb150b1 */ \
63 0xc521a612, \
64 0x2aad, \
65 0x46db, \
66 {0xb6, 0xab, 0x3b, 0x82, 0x1f, 0xb1, 0x50, 0xb1} \
69 #define NS_BINARYINPUTSTREAM_CONTRACTID "@mozilla.org/binaryinputstream;1"
71 class nsBinaryInputStream MOZ_FINAL : public nsIObjectInputStream
73 public:
74 nsBinaryInputStream()
78 protected:
79 // nsISupports methods
80 NS_DECL_ISUPPORTS
82 // nsIInputStream methods
83 NS_DECL_NSIINPUTSTREAM
85 // nsIBinaryInputStream methods
86 NS_DECL_NSIBINARYINPUTSTREAM
88 // nsIObjectInputStream methods
89 NS_DECL_NSIOBJECTINPUTSTREAM
91 nsCOMPtr<nsIInputStream> mInputStream;
92 nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
94 private:
95 // virtual dtor since subclasses call our Release()
96 virtual ~nsBinaryInputStream()
101 #endif // nsBinaryStream_h___