public void transferSucceeded()

in src/main/java/org/apache/maven/resolver/internal/ant/AntTransferListener.java [61:82]


    public void transferSucceeded(final TransferEvent event) {
        String msg = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded";
        msg += " " + event.getResource().getRepositoryUrl()
                + event.getResource().getResourceName();

        final long contentLength = event.getTransferredBytes();
        if (contentLength >= 0) {
            final String len = contentLength >= 1024 ? ((contentLength + 1023) / 1024) + " KB" : contentLength + " B";

            String throughput = "";
            final long duration =
                    System.currentTimeMillis() - event.getResource().getTransferStartTime();
            if (duration > 0) {
                final DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
                final double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0);
                throughput = " at " + format.format(kbPerSec) + " KB/sec";
            }

            msg += " (" + len + throughput + ")";
        }
        task.log(msg);
    }