本文整理汇总了Java中org.eclipse.aether.transfer.TransferEvent.getResource方法的典型用法代码示例。如果您正苦于以下问题:Java TransferEvent.getResource方法的具体用法?Java TransferEvent.getResource怎么用?Java TransferEvent.getResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.aether.transfer.TransferEvent
的用法示例。
在下文中一共展示了TransferEvent.getResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transferStarted
import org.eclipse.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferStarted(TransferEvent te) throws TransferCancelledException {
ProgressContributor c = contrib;
if (c == null || handle == null) {
return;
}
TransferResource res = te.getResource();
int total = (int)Math.min((long)Integer.MAX_VALUE, res.getContentLength());
if (total < 0) {
c.start(0);
} else {
c.start(total);
}
length = total;
c.progress(TXT_Started(getResourceName(res)));
}
示例2: transferProgressed
import org.eclipse.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 );
}
示例3: transferSucceeded
import org.eclipse.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 ){
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
throughput = " at " + format.format( kbPerSec ) + " KB/sec";
}
out.println(getDate()+ type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len+ throughput + ")" );
}
}
示例4: transferProgressed
import org.eclipse.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);
}
示例5: transferSucceeded
import org.eclipse.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 + ")");
}
}
示例6: transferProgressed
import org.eclipse.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);
if (buffer.length() > 0) {
logger.info(buffer.toString());
}
}
示例7: transferSucceeded
import org.eclipse.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) {
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
throughput = " at " + format.format(kbPerSec) + " KB/sec";
}
logger.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")");
}
}
示例8: transferSucceeded
import org.eclipse.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 )
{
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
throughput = " at " + format.format( kbPerSec ) + " KB/sec";
}
logger.info( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")" );
}
}
示例9: transferProgressed
import org.eclipse.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);
}
示例10: transferSucceeded
import org.eclipse.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.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput
+ ")");
}
}
示例11: transferSucceeded
import org.eclipse.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) {
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
throughput = " at " + format.format(kbPerSec) + " KB/sec";
}
logger.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")");
}
}
示例12: transferProgressed
import org.eclipse.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);
}
示例13: transferSucceeded
import org.eclipse.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) {
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
throughput = " at " + format.format(kbPerSec) + " KB/sec";
}
out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")");
}
}
示例14: transferSucceeded
import org.eclipse.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) {
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
throughput = " at " + format.format(kbPerSec) + " KB/sec";
}
out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")");
}
}
示例15: transferSucceeded
import org.eclipse.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 + ")");
}
}