aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/print/asciiconfigsnapshotreader.cpp
blob: 6493b815e8a3d5bb800264d5c5d742d6fa93fb4b (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
25
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "asciiconfigsnapshotreader.h"
#include "jsonconfigformatter.h"

namespace config {

AsciiConfigSnapshotReader::AsciiConfigSnapshotReader(const vespalib::asciistream & is)
    : _is(is)
{
}

ConfigSnapshot
AsciiConfigSnapshotReader::read()
{
    ConfigDataBuffer buffer;
    buffer.setEncodedString(_is.str());
    JsonConfigFormatter formatter(true);
    formatter.decode(buffer);
    ConfigSnapshot snapshot;
    snapshot.deserialize(buffer);
    return snapshot;
}

} // namespace config