#pragma once #include "buffered.h" #include #include #include #include #include namespace NYsonPull { namespace NDetail { namespace NOutput { class TStream: public TBuffered { IOutputStream* Output; public: TStream(IOutputStream* output, size_t buffer_size) : TBuffered(buffer_size) , Output(output) { } void write(TStringBuf data) { Output->Write(data); } }; template class TOwned: public TBuffered> { TOutput Output; public: template TOwned(size_t buffer_size, Args&&... args) : TBuffered(buffer_size) , Output(std::forward(args)...) { } void write(TStringBuf data) { Output.Write(data); } }; class TFHandle: public TOwned { public: TFHandle(int fd, size_t buffer_size) : TOwned(buffer_size, Duplicate(fd)) { } }; } } // namespace NDetail }