doCompleted( transferEvent );
}
protected void doCompleted( ArtifactTransferEvent transferEvent )
{
ArtifactTransferResource artifact = transferEvent.getResource();
long contentLength = transferEvent.getTransferredBytes();
if ( contentLength >= 0 )
{
String type =
( transferEvent.getRequestType() == ArtifactTransferEvent.REQUEST_PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - artifact.getTransferStartTime();
if ( duration > 0 )
{
DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
double kbPerSec = ( contentLength / 1024.0 ) / ( duration / 1000.0 );
throughput = " at " + format.format( kbPerSec ) + " KB/sec";
}
out.println( type + ": " + artifact.getUrl() + " (" + len + throughput + ")" );
}
}