summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/yson_string/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp/yt/yson_string/string.cpp')
-rw-r--r--library/cpp/yt/yson_string/string.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp
index dec428c31ef..164e450b72c 100644
--- a/library/cpp/yt/yson_string/string.cpp
+++ b/library/cpp/yt/yson_string/string.cpp
@@ -173,6 +173,28 @@ size_t TYsonString::ComputeHash() const
return THash<TStringBuf>()(TStringBuf(Begin_, Begin_ + Size_));
}
+void TYsonString::Save(IOutputStream* s) const
+{
+ EYsonType type = Type_;
+ if (*this) {
+ ::SaveMany(s, type, ToSharedRef());
+ } else {
+ ::SaveMany(s, type, TString());
+ }
+}
+
+void TYsonString::Load(IInputStream* s)
+{
+ EYsonType type;
+ TString data;
+ ::LoadMany(s, type, data);
+ if (data) {
+ *this = TYsonString(data, type);
+ } else {
+ *this = TYsonString();
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
TString ToString(const TYsonString& yson)