本文整理汇总了Java中org.sonatype.aether.transfer.TransferEvent类的典型用法代码示例。如果您正苦于以下问题:Java TransferEvent类的具体用法?Java TransferEvent怎么用?Java TransferEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransferEvent类属于org.sonatype.aether.transfer包,在下文中一共展示了TransferEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transferProgressed
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferProgressed(TransferEvent event) {
TransferResource resource = event.getResource();
downloads.put(resource, Long.valueOf(event.getTransferredBytes()));
StringBuilder buffer = new StringBuilder(64);
for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append(getStatus(complete, total)).append(" ");
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad(buffer, pad);
buffer.append('\r');
logger.info(buffer.toString());
}
示例2: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded(TransferEvent event) {
transferCompleted(event);
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if (contentLength >= 0) {
String type =
(event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded");
String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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";
}
logger.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
+ len + throughput + ")");
}
}
示例3: transferProgressed
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferProgressed(TransferEvent event) {
TransferResource resource = event.getResource();
downloads.put(resource, event.getTransferredBytes());
StringBuilder buffer = new StringBuilder(64);
for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
long total = entry.getKey().getContentLength();
long complete = entry.getValue();
buffer.append(getStatus(complete, total)).append(" ");
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad(buffer, pad);
buffer.append('\r');
logger.info(buffer.toString());
}
示例4: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded(TransferEvent event)
{
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if (contentLength >= 0) {
String type = (event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded");
String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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";
}
logger.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")");
}
}
示例5: transferProgressed
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferProgressed( TransferEvent event )
{
TransferResource resource = event.getResource();
downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
StringBuilder buffer = new StringBuilder( 64 );
for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
{
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append( getStatus( complete, total ) ).append( " " );
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad( buffer, pad );
log.debug(buffer);
}
示例6: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded( TransferEvent event )
{
transferCompleted( event );
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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";
}
log.info("{}: {}{} ({} {})", type, resource.getRepositoryUrl(), resource.getResourceName(), len, throughput);
}
}
示例7: transferProgressed
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferProgressed(TransferEvent event)
{
TransferResource resource = event.getResource();
downloads.put(resource, Long.valueOf(event.getTransferredBytes()));
StringBuilder buffer = new StringBuilder(64);
for (Map.Entry<TransferResource, Long> entry : downloads.entrySet())
{
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append(getStatus(complete, total)).append(" ");
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad(buffer, pad);
buffer.append('\r');
log.trace(buffer);
}
示例8: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded(TransferEvent event)
{
transferCompleted(event);
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if (contentLength >= 0)
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded"
: "Downloaded" );
String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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";
}
log.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")");
}
}
示例9: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded( TransferEvent event )
{
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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 + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")" );
}
}
示例10: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded( TransferEvent event )
{
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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.info( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")" );
}
}
示例11: transferProgressed
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferProgressed( TransferEvent event )
{
TransferResource resource = event.getResource();
downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
StringBuilder buffer = new StringBuilder( 64 );
for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
{
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append( getStatus( complete, total ) ).append( " " );
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad( buffer, pad );
buffer.append( '\r' );
print( "transferProgressed", buffer.toString() );
}
示例12: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded( TransferEvent event )
{
transferCompleted( event );
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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";
}
println( "transferSucceeded", type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
+ len + throughput + ")" );
}
}
示例13: transferProgressed
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferProgressed( TransferEvent event )
{
TransferResource resource = event.getResource();
downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
StringBuilder buffer = new StringBuilder( 64 );
for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
{
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append( getStatus( complete, total ) ).append( " " );
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad( buffer, pad );
buffer.append( '\r' );
out.print( buffer );
}
示例14: transferSucceeded
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferSucceeded( TransferEvent event )
{
transferCompleted( event );
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.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 + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")" );
}
}
示例15: transferInitiated
import org.sonatype.aether.transfer.TransferEvent; //导入依赖的package包/类
@Override
public void transferInitiated(TransferEvent event) {
String message =
event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
logger.info(message + ": " + event.getResource().getRepositoryUrl()
+ event.getResource().getResourceName());
}