1 // Copyright 2017 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_SEEKABLEMULTISTREAM_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_SEEKABLEMULTISTREAM_H_ 9 10 #include <vector> 11 12 #include "core/fxcrt/fx_stream.h" 13 #include "core/fxcrt/retain_ptr.h" 14 15 class CPDF_Stream; 16 class CPDF_StreamAcc; 17 18 class CPDF_SeekableMultiStream final : public IFX_SeekableStream { 19 public: 20 explicit CPDF_SeekableMultiStream( 21 std::vector<RetainPtr<const CPDF_Stream>> streams); 22 ~CPDF_SeekableMultiStream() override; 23 24 // IFX_SeekableReadStream: 25 FX_FILESIZE GetPosition() override; 26 FX_FILESIZE GetSize() override; 27 bool IsEOF() override; 28 size_t ReadBlock(pdfium::span<uint8_t> buffer) override; 29 bool ReadBlockAtOffset(pdfium::span<uint8_t> buffer, 30 FX_FILESIZE offset) override; 31 bool WriteBlockAtOffset(pdfium::span<const uint8_t> buffer, 32 FX_FILESIZE offset) override; 33 bool Flush() override; 34 35 private: 36 std::vector<RetainPtr<CPDF_StreamAcc>> m_Data; 37 }; 38 39 #endif // CORE_FPDFAPI_PARSER_CPDF_SEEKABLEMULTISTREAM_H_ 40