ArrayBufferInputStream.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef ArrayBufferInputStream_h
  6. #define ArrayBufferInputStream_h
  7. #include "nsIArrayBufferInputStream.h"
  8. #include "js/Value.h"
  9. #include "mozilla/Maybe.h"
  10. #include "mozilla/UniquePtr.h"
  11. #define NS_ARRAYBUFFERINPUTSTREAM_CONTRACTID "@mozilla.org/io/arraybuffer-input-stream;1"
  12. #define NS_ARRAYBUFFERINPUTSTREAM_CID \
  13. { /* 3014dde6-aa1c-41db-87d0-48764a3710f6 */ \
  14. 0x3014dde6, \
  15. 0xaa1c, \
  16. 0x41db, \
  17. {0x87, 0xd0, 0x48, 0x76, 0x4a, 0x37, 0x10, 0xf6} \
  18. }
  19. class ArrayBufferInputStream : public nsIArrayBufferInputStream {
  20. public:
  21. ArrayBufferInputStream();
  22. NS_DECL_ISUPPORTS
  23. NS_DECL_NSIARRAYBUFFERINPUTSTREAM
  24. NS_DECL_NSIINPUTSTREAM
  25. private:
  26. virtual ~ArrayBufferInputStream() {}
  27. mozilla::UniquePtr<char[]> mArrayBuffer;
  28. uint32_t mBufferLength;
  29. uint32_t mPos;
  30. bool mClosed;
  31. };
  32. #endif // ArrayBufferInputStream_h