/** * Log a message to the log listener. * @param message the message to log */ protected void log(final String message) { listener.log(message); }
/** * Log transfer stats to the log listener. * @param timeStarted the time started * @param timeEnded the finishing time * @param totalLength the total length */ protected void logStats(final long timeStarted, final long timeEnded, final long totalLength) { final double duration = (timeEnded - timeStarted) / ONE_SECOND; final NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(2); format.setMinimumFractionDigits(1); listener.log("File transfer time: " + format.format(duration) + " Average Rate: " + format.format(totalLength / duration) + " B/s"); }