/** * @return * the expected total of bytes that will be transferred by the watched threads. * @throws IllegalStateException * if the bytes transferred information is not available - check this availability * with the {@link #isBytesTransferredInfoAvailable()} method. */ public long getBytesTotal() throws IllegalStateException { if (!isBytesTransferredInfoAvailable()) { throw new IllegalStateException("Bytes Transferred Info is not available in this object"); } return BytesProgressWatcher.sumBytesToTransfer(progressWatchers); }
/** * @return * the expected total of bytes that will be transferred by the watched threads. * @throws IllegalStateException * if the bytes transferred information is not available - check this availability * with the {@link #isBytesTransferredInfoAvailable()} method. */ public long getBytesTotal() throws IllegalStateException { if (!isBytesTransferredInfoAvailable()) { throw new IllegalStateException("Bytes Transferred Info is not available in this object"); } return BytesProgressWatcher.sumBytesToTransfer(progressWatchers); }
/** * @return * the count of bytes that have been transferred by the watched threads. * @throws IllegalStateException * if the bytes transferred information is not available - check this availability * with the {@link #isBytesTransferredInfoAvailable()} method. */ public long getBytesTransferred() { if (!isBytesTransferredInfoAvailable()) { throw new IllegalStateException("Bytes Transferred Info is not available in this object"); } return BytesProgressWatcher.sumBytesTransferred(progressWatchers); }
/** * @return * the count of bytes that have been transferred by the watched threads. * @throws IllegalStateException * if the bytes transferred information is not available - check this availability * with the {@link #isBytesTransferredInfoAvailable()} method. */ public long getBytesTransferred() { if (!isBytesTransferredInfoAvailable()) { throw new IllegalStateException("Bytes Transferred Info is not available in this object"); } return BytesProgressWatcher.sumBytesTransferred(progressWatchers); }
private void displayProgressStatus(String prefix, ThreadWatcher watcher) { String progressMessage = prefix + watcher.getCompletedThreads() + "/" + watcher.getThreadCount(); // Show percentage of bytes transferred, if this info is available. if (watcher.isBytesTransferredInfoAvailable()) { String bytesTotalStr = byteFormatter.formatByteSize(watcher.getBytesTotal()); long percentage = (int) (((double)watcher.getBytesTransferred() / watcher.getBytesTotal()) * 100); String detailsText = formatTransferDetails(watcher); progressMessage += " - " + percentage + "% of " + bytesTotalStr + (detailsText.length() > 0 ? " (" + detailsText + ")" : ""); } else { long percentage = (int) (((double)watcher.getCompletedThreads() / watcher.getThreadCount()) * 100); progressMessage += " - " + percentage + "%"; } printProgressLine(progressMessage); }
private void displayProgressStatus(String prefix, ThreadWatcher watcher) { String progressMessage = prefix + watcher.getCompletedThreads() + "/" + watcher.getThreadCount(); // Show percentage of bytes transferred, if this info is available. if (watcher.isBytesTransferredInfoAvailable()) { String bytesTotalStr = byteFormatter.formatByteSize(watcher.getBytesTotal()); long percentage = (int) (((double)watcher.getBytesTransferred() / watcher.getBytesTotal()) * 100); String detailsText = formatTransferDetails(watcher); progressMessage += " - " + percentage + "% of " + bytesTotalStr + (detailsText.length() > 0 ? " (" + detailsText + ")" : ""); } else { long percentage = (int) (((double)watcher.getCompletedThreads() / watcher.getThreadCount()) * 100); progressMessage += " - " + percentage + "%"; } printProgressLine(progressMessage); }