• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2022 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 #include "core/fxcrt/cfx_read_only_string_stream.h"
6 
7 #include <utility>
8 
9 #include "core/fxcrt/cfx_read_only_span_stream.h"
10 #include "core/fxcrt/span.h"
11 
CFX_ReadOnlyStringStream(ByteString data)12 CFX_ReadOnlyStringStream::CFX_ReadOnlyStringStream(ByteString data)
13     : data_(std::move(data)),
14       stream_(
15           pdfium::MakeRetain<CFX_ReadOnlySpanStream>(data_.unsigned_span())) {}
16 
17 CFX_ReadOnlyStringStream::~CFX_ReadOnlyStringStream() = default;
18 
GetSize()19 FX_FILESIZE CFX_ReadOnlyStringStream::GetSize() {
20   return stream_->GetSize();
21 }
22 
ReadBlockAtOffset(pdfium::span<uint8_t> buffer,FX_FILESIZE offset)23 bool CFX_ReadOnlyStringStream::ReadBlockAtOffset(pdfium::span<uint8_t> buffer,
24                                                  FX_FILESIZE offset) {
25   return stream_->ReadBlockAtOffset(buffer, offset);
26 }
27