![]() |
C++客户端开发接口库 V5.1.8.15
连接信创集成中间件服务程序的二次开发接口
|
#include <FileTransferHelper.h>
Public 成员函数 | |
| CFileTransferHelper (unsigned char uRouteNode=0) | |
| CFileTransferHelper (CMidLinkComm *MidComm) | |
| ~CFileTransferHelper () | |
| void | SetProgressCallback (std::function< PPROGRESSCALLBACK > pCallback) |
| std::string | GetLastErrorMessage () |
| int | GetLastErrorCode () |
| int64_t | DownLoadFile (const std::string &sLocalFileName, const std::string &sRemoteFileName, bool ResumeBreak, int64_t iFileSize=0, const std::string &sVerifyMD5="", int iDownReqNo=RDMS_DOWNLOADFILE) |
| int64_t | DownLoadFile (const std::string &sRemoteFileName, std::streambuf &sRcvStream, int64_t iFileSize=0, int iDownReqNo=RDMS_DOWNLOADFILE) |
| std::vector< REMOTE_FILE_INFO > | GetServerDirectoryFileInfo (const std::string &sPathName, bool bSearchSubDir=true, bool bCalculateMD5=false, int iDownReqNo=RDMS_GETDIR_FILEINFO) |
| bool | DownloadDirectoryFiles (const std::string &sPathName, const std::string &sSavePathTo, bool bIncludeSubDir=true, int iDownReqNo=RDMS_DOWNLOAD_FLODER) |
| bool | BatchDownLoadFiles (const std::vector< REMOTE_FILE_INFO > &lstFiles, const std::string &sSavePathTo, REMOTE_STORE_TYPE store_type=REMOTE_STORE_TYPE::DAS, bool ResumeBreak=true, const std::string &sSotrePara="", int iDownReqNo=RDMS_BATCHGET_FILES) |
| int | UpLoadFile (const std::string &sLocalFileName, const std::string &sServerSaveFileName, bool ResumeBreak=true, int iUploadReqNo=RDMS_UPLOAD_FILE) |
| bool | UpLoadFileToMidCache (const std::string &sLocalFileName, std::string &sFileMD5, int iUploadReqNo=RDMS_SAVEFILE_CACHE) |
| int | BatchUpLoadFiles (const std::vector< SEND_FILE_INFO > &lstFiles, int iUploadReqNo=RDMS_UPLOAD_FILE, const std::string &sAddToMidFileCache="Auto") |
| int | UpLoadDirectoryFile (const std::string &sLocalPathName, const std::string &sSavePathTo, bool bIncludeSubDir=true, bool ResumeBreak=true, int iUploadReqNo=RDMS_UPLOAD_FILE) |
| int | UpLoadFrontServerFileToRemote (unsigned char uRemoteNode, const std::string &sFSPathName, const std::string &sRSPathName, bool bIncludeSubDir=true, const std::string &sAddToCache="AUTO", int iUploadReqNo=RDMS_UPLOAD_FSFILE) |
| bool | DeleteServerFile (const std::string &sServerFileName, const std::string &sFloderDelteMode="", int iReqNo=RDMS_DELET_FILE) |
| std::vector< std::string > | ReadMTPFile (const std::string &sFileName) |
静态 Public 成员函数 | |
| static int64_t | GetFileMD5 (const std::string &sFileName, std::string &sMD5Value) |
| static bool | GetFileMD5 (const std::string &sFileName, int64_t &iFileSize, std::string &sMD5Value) |
| static std::string | SpeedFormat (int speed) |
| static std::string | TimeFormat (int64_t time, bool bIsMicrosecond=false) |
文件传送功能,线程不安全,使用完成后必须调用Dispose回收通信连接
| mdwc::CFileTransferHelper::CFileTransferHelper | ( | unsigned char | uRouteNode = 0 | ) |
构造函数,使用完成后必须调用Dispose回收通信连接
| uRouteNode | 数据转到目标节点,为0不转发 |
| mdwc::CFileTransferHelper::CFileTransferHelper | ( | CMidLinkComm * | MidComm | ) |
构造函数,使用完成后必须调用Dispose回收通信连接
| MidComm | 使用已经分配的通信连接,实例释放时不会从连接池中释放,调用者要处理好多线程使用的冲突和保证释放 |
| mdwc::CFileTransferHelper::~CFileTransferHelper | ( | ) |
析构函数,释放占用的通信连接
| bool mdwc::CFileTransferHelper::BatchDownLoadFiles | ( | const std::vector< REMOTE_FILE_INFO > & | lstFiles, |
| const std::string & | sSavePathTo, | ||
| REMOTE_STORE_TYPE | store_type = REMOTE_STORE_TYPE::DAS, | ||
| bool | ResumeBreak = true, | ||
| const std::string & | sSotrePara = "", | ||
| int | iDownReqNo = RDMS_BATCHGET_FILES ) |
批模式下载文件
| lstFiles | 要下载的文件列表 |
| sSavePathTo | 保存到本地方文件夹 |
| ResumeBreak | 文件断点续传,已经存在的文件不传送 |
| store_type | 服务端文件存储类型 |
| sSotrePara | 访问文件存储服务的参数,如对象存储接口,FTP服务器连接参数等,格式参数中间件相关文档 |
| iDownReqNo | 调用的中间件业务脚本号 |

| int mdwc::CFileTransferHelper::BatchUpLoadFiles | ( | const std::vector< SEND_FILE_INFO > & | lstFiles, |
| int | iUploadReqNo = RDMS_UPLOAD_FILE, | ||
| const std::string & | sAddToMidFileCache = "Auto" ) |
批量上传文件到服务器
| lstFiles | 要上传的文件列表 |
| iUploadReqNo | 上传文件业务功能号 |
| sAddToMidFileCache | 是否将文件添加到中间件文件缓存中, 'Auto'表示由中间件服务器确定,'Yes'表示添加,'No'表示不添加 |


| bool mdwc::CFileTransferHelper::DeleteServerFile | ( | const std::string & | sServerFileName, |
| const std::string & | sFloderDelteMode = "", | ||
| int | iReqNo = RDMS_DELET_FILE ) |
删除服务器上的文件
| sServerFileName | 服务器上的文件名 |
| sFloderDelteMode | 文件夹删除处理模式 "DELDIR"–直接删除整个文件夹 空值–文件夹为空时递归删除 "DIREMPTYNODEL"–文件夹为空时不删除 |
| iReqNo | 删除文件功能号 |
| bool mdwc::CFileTransferHelper::DownloadDirectoryFiles | ( | const std::string & | sPathName, |
| const std::string & | sSavePathTo, | ||
| bool | bIncludeSubDir = true, | ||
| int | iDownReqNo = RDMS_DOWNLOAD_FLODER ) |
下载服务器指定文件夹中文件
| sPathName | 文件夹名称 |
| sSavePathTo | 保存到本地文件夹 |
| bIncludeSubDir | 是否包括子文件夹 |
| iDownReqNo |
| int64_t mdwc::CFileTransferHelper::DownLoadFile | ( | const std::string & | sLocalFileName, |
| const std::string & | sRemoteFileName, | ||
| bool | ResumeBreak, | ||
| int64_t | iFileSize = 0, | ||
| const std::string & | sVerifyMD5 = "", | ||
| int | iDownReqNo = RDMS_DOWNLOADFILE ) |
从服务器下载文件保存,支持断点续传
| sLocalFileName | 本地文件名 |
| sRemoteFileName | 文件名(服务器上、全路径) |
| ResumeBreak | 是否使用断点续传 |
| iFileSize | 要下载的文件尺寸,为0不对尺寸进行检查 |
| sVerifyMD5 | 效验文件下载是否成功的MD5值,为空不进行效验 |
| iDownReqNo | 下载文件中间件业务功能号 |

| int64_t mdwc::CFileTransferHelper::DownLoadFile | ( | const std::string & | sRemoteFileName, |
| std::streambuf & | sRcvStream, | ||
| int64_t | iFileSize = 0, | ||
| int | iDownReqNo = RDMS_DOWNLOADFILE ) |
从服务器下载文件到内存
| sRemoteFileName | 文件名(服务器上、全路径) |
| sRcvStream | 输出已接受的内存流 |
| iFileSize | 文件大小 |
| iDownReqNo | 下载文件业务功能号 |
|
static |
取得文件的MD5效验值
| sFileName | 文件名, Windows下,调用前转换GBK编码 |
| iFileSize | 要计算MD5的文件尺寸 |
| sMD5Value | 返回的MD5效验值 |
|
static |
取得文件的MD5效验值
| sFileName | 文件名, Windows下,调用前转换GBK编码 |
| sMD5Value | 返回的MD5效验值 |

| int mdwc::CFileTransferHelper::GetLastErrorCode | ( | ) |
取得最后执行的错误代码
| std::string mdwc::CFileTransferHelper::GetLastErrorMessage | ( | ) |
取得最后执行的错误信息描述
| std::vector< mdwc::REMOTE_FILE_INFO > mdwc::CFileTransferHelper::GetServerDirectoryFileInfo | ( | const std::string & | sPathName, |
| bool | bSearchSubDir = true, | ||
| bool | bCalculateMD5 = false, | ||
| int | iDownReqNo = RDMS_GETDIR_FILEINFO ) |
获取服务器指定文件夹中文件信息
| sPathName | 文件夹名称 |
| bSearchSubDir | 是否搜索子文件夹 |
| bCalculateMD5 | 是否计算文件MD5值,要计算MD5时,文件多,等待时间过长 |
| iDownReqNo | 取得文件夹信息功能号 |
| std::vector< std::string > mdwc::CFileTransferHelper::ReadMTPFile | ( | const std::string & | sFileName | ) |
读取MTP数据文件到vector<std::string>对象
| sFileName | MTP文件名 |
|
inline |
设置处理进度回调函数
|
static |
格式化传输速度.
| speed | 传输速度,单位为KB/s |

|
static |
格式化传输时间.
| time | 时间值,默认单位为毫秒, bIsMicrosecond=true时间单位为微秒 |
| bIsMicrosecond | 是否为微秒 |
| int mdwc::CFileTransferHelper::UpLoadDirectoryFile | ( | const std::string & | sLocalPathName, |
| const std::string & | sSavePathTo, | ||
| bool | bIncludeSubDir = true, | ||
| bool | ResumeBreak = true, | ||
| int | iUploadReqNo = RDMS_UPLOAD_FILE ) |
上传本地文件夹中的文件到服务器
| sLocalPathName | 本地文件夹名称 |
| sSavePathTo | 保存到服务器文件夹 |
| bIncludeSubDir | 是否包括子文件夹 |
| ResumeBreak | 文件断点续传,服务端已经存在的文件不传送 |
| iUploadReqNo | 上传文件业务功能号 |

| int mdwc::CFileTransferHelper::UpLoadFile | ( | const std::string & | sLocalFileName, |
| const std::string & | sServerSaveFileName, | ||
| bool | ResumeBreak = true, | ||
| int | iUploadReqNo = RDMS_UPLOAD_FILE ) |
上传文件到服务器
| sLocalFileName | 本地文件(全路径) |
| sServerSaveFileName | 服务器文件名,如果不含文件名,使用本地文件名 |
| ResumeBreak | 文件断点续传,已经存在的文件不传送 |
| iUploadReqNo | 上传文件业务功能号 |

| bool mdwc::CFileTransferHelper::UpLoadFileToMidCache | ( | const std::string & | sLocalFileName, |
| std::string & | sFileMD5, | ||
| int | iUploadReqNo = RDMS_SAVEFILE_CACHE ) |
保存文件到中间件服务器文件缓存中
| sLocalFileName | 本地文件(全路径) |
| sFileMD5 | 本地文件MD5值,为空将自动计算 |
| iUploadReqNo | 上传文件业务功能号 |

| int mdwc::CFileTransferHelper::UpLoadFrontServerFileToRemote | ( | unsigned char | uRemoteNode, |
| const std::string & | sFSPathName, | ||
| const std::string & | sRSPathName, | ||
| bool | bIncludeSubDir = true, | ||
| const std::string & | sAddToCache = "AUTO", | ||
| int | iUploadReqNo = RDMS_UPLOAD_FSFILE ) |
上传前置中间件服务器上的文件到远程服务器
| uRemoteNode | 远程节点号 |
| sFSPathName | 前置服务器上可读写的全路径文件名或文件夹 |
| sRSPathName | 保存到服务器上伯文件名或文件夹 |
| bIncludeSubDir | 是否上传子文件夹中所有文件 |
| sAddToCache | 上传后是否添加到中间件文件缓存中,AUTO–服务器开启缓存确定,YES/TRUE–添加,其他值不添加 |
| iUploadReqNo | 上传文件业务功能号 |