List of usage examples for com.amazonaws.event ProgressEventType isByteCountEvent
public boolean isByteCountEvent()
From source file:com.github.rholder.esthree.progress.PrintingProgressListener.java
License:Apache License
@Override public void progressChanged(ProgressEvent progressEvent) { ProgressEventType type = progressEvent.getEventType(); if (type.equals(TRANSFER_COMPLETED_EVENT) || type.equals(TRANSFER_STARTED_EVENT)) { out.println();/* w w w . j ava 2 s . co m*/ } if (type.isByteCountEvent()) { long timeLeft = getTimeLeft(); if (lastTimeLeft < 1 && timeLeft > 0) { // prime this value with a sane starting point lastTimeLeft = timeLeft; } // use an exponential moving average to smooth the estimate lastTimeLeft += 0.90 * (timeLeft - lastTimeLeft); out.print(String.format("\r%1$s %2$s / %3$s %4$s ", generate(saturatedCast(round(completed + (progress.getPercentTransferred() * multiplier)))), humanReadableByteCount(progress.getBytesTransferred(), true), humanReadableByteCount(progress.getTotalBytesToTransfer(), true), fromSeconds(lastTimeLeft))); out.flush(); } }