我使用 ssh conn 从服务器下载文件
SshClient client = new SshClient();
client.init(vmIP,sshUser,sshPassword);
long startTime = Instant.now().getEpochSecond();
string response = client.exec("wget x.x.x.x/5MB.zip");
if (response.contains(fileName) && response.contains("100%"))
{long endTime = Instant.now().getEpochSecond();}
long difference = startTime- endTime;
wget 给出如下响应
Connecting to x.x.x.:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5242880 (5.0M) [application/zip]
Saving to: ‘5MB.zip.42’
0K .......... .......... .......... .......... .......... 0% 5.97M 1s
50K .......... .......... .......... .......... .......... 1% 6.17M 1s
100K .......... .......... .......... .......... .......... 2% 51.1M 1s
150K .......... .......... .......... .......... .......... 3% 6.80M 1s
200K .......... .......... .......... .......... .......... 4% 67.1M 0s
.
.
.
.
.
4800K .......... .......... .......... .......... .......... 94% 5.04M 0s
4850K .......... .......... .......... .......... .......... 95% 49.2M 0s
4900K .......... .......... .......... .......... .......... 96% 6.19M 0s
4950K .......... .......... .......... .......... .......... 97% 6.23M 0s
5000K .......... .......... .......... .......... .......... 98% 65.4M 0s
5050K .......... .......... .......... .......... .......... 99% 6.61M 0s
5100K .......... .......... 100% 232M=0.5s
如何在运行时监控文件下载百分比的进度?