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___
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 */ \
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
31 nsBinaryOutputStream()
36 // nsISupports methods
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
;
55 // virtual dtor since subclasses call our Release()
56 virtual ~nsBinaryOutputStream()
61 #define NS_BINARYINPUTSTREAM_CID \
62 { /* c521a612-2aad-46db-b6ab-3b821fb150b1 */ \
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
79 // nsISupports methods
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
;
95 // virtual dtor since subclasses call our Release()
96 virtual ~nsBinaryInputStream()
101 #endif // nsBinaryStream_h___