output.cpp 893 B

1234567891011121314151617181920212223242526272829
  1. #include "output.h"
  2. #include <library/cpp/yson_pull/detail/output/stdio_file.h>
  3. #include <library/cpp/yson_pull/detail/output/stream.h>
  4. #include <util/generic/ptr.h>
  5. #include <util/stream/file.h>
  6. #include <util/stream/str.h>
  7. using namespace NYsonPull::NOutput;
  8. using namespace NYsonPull::NDetail::NOutput;
  9. namespace NOutput = NYsonPull::NOutput;
  10. THolder<IStream> NOutput::FromStdioFile(FILE* file, size_t buffer_size) {
  11. return MakeHolder<TStdioFile>(file, buffer_size);
  12. }
  13. THolder<IStream> NOutput::FromPosixFd(int fd, size_t buffer_size) {
  14. return MakeHolder<TFHandle>(fd, buffer_size);
  15. }
  16. THolder<IStream> NOutput::FromString(TString* output, size_t buffer_size) {
  17. return MakeHolder<TOwned<TStringOutput>>(buffer_size, *output);
  18. }
  19. THolder<IStream> NOutput::FromOutputStream(IOutputStream* output, size_t buffer_size) {
  20. return MakeHolder<TStream>(output, buffer_size);
  21. }