public String getPercentComplete() { double p = ((double) m_bytes / m_bytesTotal) * 100.0f; m_monitor.worked((int) ((p - m_percent) * 100)); m_percent = p; DecimalFormat df = new DecimalFormat("0.##"); return PaddedString.rpad((df.format(m_percent) + " % Complete"), 25); }
public String getTimeLeft() { // prevent divide by 0 zero if (m_speed != 0) { // Averages the speed + prevents divide by zero safe long time = (m_bytesTotal - m_bytes) / m_speed; String duration = "Time Remaining: "; getTime.time = time; duration += getTime.run(YEAR, "y"); duration += getTime.run(MONTH, "mo"); duration += getTime.run(WEEK, "w"); duration += getTime.run(DAY, "d"); duration += getTime.run(HOUR, "h"); duration += getTime.run(MINUTE, "m"); duration += getTime.run(SECOND, "s"); return PaddedString.rpad(duration, 40); } return "Infinite time"; }
public String getTransferSpeed() { return PaddedString.rpad("Speed: " + interpretBytes(m_speed) + "/sec", 20); }
public String getTransferSize() { return PaddedString.rpad( ("Transferred: " + interpretBytes(m_bytes) + "/" + interpretBytes(m_bytesTotal)), 25); }
public String getNumberFiles() { return PaddedString.rpad("File: " + m_count + "/" + m_fileCount, 25); }