blob: 2a5dbb7dfc7050d27fd4d3ccfda63d6c45f67c14 [file] [log] [blame]
// Copyright 2018 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/string_write_stream.h"
#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/widestring.h"
#include "third_party/base/check.h"
StringWriteStream::StringWriteStream() = default;
StringWriteStream::~StringWriteStream() = default;
FX_FILESIZE StringWriteStream::GetSize() {
return stream_.tellp();
}
bool StringWriteStream::Flush() {
return true;
}
bool StringWriteStream::WriteBlockAtOffset(const void* pData,
FX_FILESIZE offset,
size_t size) {
DCHECK(offset == 0);
stream_.write(static_cast<const char*>(pData), size);
return true;
}
bool StringWriteStream::WriteString(ByteStringView str) {
stream_.write(str.unterminated_c_str(), str.GetLength());
return true;
}