You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
696 B
33 lines
696 B
package xyz.wbsite.deployee.util.ssh;
|
|
|
|
import cn.hutool.core.io.StreamProgress;
|
|
|
|
/**
|
|
* SimpleProgress包装类
|
|
*/
|
|
public class SshStreamProgressWrapper implements StreamProgress {
|
|
private int val;
|
|
private SshSimpleProgress progress;
|
|
|
|
public SshStreamProgressWrapper(SshSimpleProgress progress) {
|
|
this.progress = progress;
|
|
}
|
|
|
|
@Override
|
|
public void start() {
|
|
progress.update(val);
|
|
}
|
|
|
|
@Override
|
|
public void progress(long total, long progressSize) {
|
|
int newVal = (int) (progressSize * 100.0 / total);
|
|
if (newVal > val) {
|
|
progress.update(val = newVal);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void finish() {
|
|
|
|
}
|
|
} |