Core/SSH: Some more methods

git-svn-id: svn://ultimatepp.org/upp/trunk@12155 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-08-09 13:14:58 +00:00
parent 5571f5f2ed
commit b982e430e0
2 changed files with 18 additions and 4 deletions

View file

@ -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;

View file

@ -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);