blob: 77e68252e91a97ed48ef779f034241c12ba8cf86 [file] [log] [blame]
Dan Sinclair048afc62018-05-01 17:01:54 +00001// Copyright 2018 PDFium Authors. All rights reserved.
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 "testing/string_write_stream.h"
6#include "core/fxcrt/bytestring.h"
7#include "core/fxcrt/widestring.h"
8
9StringWriteStream::StringWriteStream() = default;
10
11StringWriteStream::~StringWriteStream() = default;
12
13FX_FILESIZE StringWriteStream::GetSize() {
14 return stream_.tellp();
15}
16
17bool StringWriteStream::Flush() {
18 return true;
19}
20
Lei Zhang59f76232018-11-15 20:22:59 +000021bool StringWriteStream::WriteBlockAtOffset(const void* pData,
22 FX_FILESIZE offset,
23 size_t size) {
Dan Sinclair048afc62018-05-01 17:01:54 +000024 ASSERT(offset == 0);
25 stream_.write(static_cast<const char*>(pData), size);
26 return true;
27}
28
29bool StringWriteStream::WriteString(const ByteStringView& str) {
30 stream_.write(str.unterminated_c_str(), str.GetLength());
31 return true;
32}