1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef STREAM_H_ 6 #define STREAM_H_ 7 8 #include "DecoderDoctorLogger.h" 9 #include "nsISupportsImpl.h" 10 11 namespace mozilla { 12 13 DDLoggedTypeDeclName(ByteStream); 14 15 class ByteStream : public DecoderDoctorLifeLogger<ByteStream> { 16 public: 17 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ByteStream); 18 19 virtual bool ReadAt(int64_t offset, void* data, size_t size, 20 size_t* bytes_read) = 0; 21 virtual bool CachedReadAt(int64_t offset, void* data, size_t size, 22 size_t* bytes_read) = 0; 23 virtual bool Length(int64_t* size) = 0; 24 DiscardBefore(int64_t offset)25 virtual void DiscardBefore(int64_t offset) {} 26 27 protected: ~ByteStream()28 virtual ~ByteStream() {} 29 }; 30 31 } // namespace mozilla 32 33 #endif 34