blob: b526d26b7e2b0bd4b983d21c45421bf396e862bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "asciiconfigsnapshotwriter.h"
#include "jsonconfigformatter.h"
namespace config {
AsciiConfigSnapshotWriter::AsciiConfigSnapshotWriter(vespalib::asciistream & os)
: _os(os)
{
}
bool
AsciiConfigSnapshotWriter::write(const ConfigSnapshot & snapshot)
{
ConfigDataBuffer buffer;
snapshot.serialize(buffer);
JsonConfigFormatter formatter(true);
formatter.encode(buffer);
_os << buffer.getEncodedString();
return !_os.fail();
}
} // namespace config
|