diff --git a/uppsrc/Core/SSH/SFtp.cpp b/uppsrc/Core/SSH/SFtp.cpp index a8617797e..e5f39bc88 100644 --- a/uppsrc/Core/SSH/SFtp.cpp +++ b/uppsrc/Core/SSH/SFtp.cpp @@ -279,6 +279,18 @@ String SFtp::LoadFile(const char *path) return LoadStream(in); } +bool SFtp::SaveFile(const char *path, Stream& in) +{ + SFtpFileOut out(*this, path); + return CopyStream(out, in) >= 0; +} + +void SFtp::LoadFile(Stream& out, const char *path) +{ + SFtpFileIn in(*this, path); + return CopyStream(in, out) >= 0; +} + bool SFtp::Get(SFtpHandle handle, Stream& out) { sftp->done = 0; diff --git a/uppsrc/Core/SSH/SFtp.h b/uppsrc/Core/SSH/SFtp.h index 867a958e2..188c7c036 100644 --- a/uppsrc/Core/SSH/SFtp.h +++ b/uppsrc/Core/SSH/SFtp.h @@ -95,10 +95,12 @@ public: SFtp& Seek(SFtpHandle handle, int64 position); int64 GetPos(SFtpHandle handle); - int Get(SFtpHandle handle, void *ptr, int size = INT_MAX); - bool Put(SFtpHandle handle, const void *ptr, int size); - bool SaveFile(const char *path, const String& data); - String LoadFile(const char *path); + int Get(SFtpHandle handle, void *ptr, int size = INT_MAX); + bool Put(SFtpHandle handle, const void *ptr, int size); + bool SaveFile(const char *path, const String& data); + String LoadFile(const char *path); + bool SaveFile(const char *path, Stream& in); + void LoadFile(Stream& out, const char *path); // Read/Write bool Get(SFtpHandle handle, Stream& out);