本文整理汇总了Java中org.eclipse.aether.transfer.TransferEvent类的典型用法代码示例。如果您正苦于以下问题:Java TransferEvent类的具体用法?Java TransferEvent怎么用?Java TransferEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransferEvent类属于org.eclipse.aether.transfer包,在下文中一共展示了TransferEvent类的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包/类
@Messages({
"# {0} - transferring resource name",
"TXT_Transferring={0} - Transferring...",
"# {0} - transferring resource name",
"# {1} - transferred amount",
"TXT_Transferred={0} - Transferred {1}"
})
@Override
public void transferProgressed(TransferEvent te) throws TransferCancelledException {
checkCancel();
ProgressContributor c = contrib;
if (c == null) {
return;
}
long cnt = te.getTransferredBytes();
cnt = Math.min((long)Integer.MAX_VALUE, cnt);
if (length < 0) {
c.progress(TXT_Transferring(getResourceName(te.getResource())));
} else {
cnt = Math.min(cnt, (long)length);
c.progress(TXT_Transferred(getResourceName(te.getResource()), cnt), (int)cnt);
}
}
示例3: 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 );
}
示例4: 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 + ")" );
}
}
示例5: failuresAsString
import org.eclipse.aether.transfer.TransferEvent; //导入依赖的package包/类
public String failuresAsString() {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, List<TransferEvent>> entry : this.transfers.entrySet()) {
final String resourceName = entry.getKey();
for (TransferEvent event : entry.getValue()) {
sb.append("Failed")
.append(event.getRequestType() == TransferEvent.RequestType.PUT ? " uploading " : " downloading ")
.append(resourceName)
.append(event.getRequestType() == TransferEvent.RequestType.PUT ? " into " : " from ")
.append(event.getResource().getRepositoryUrl()).append(". ");
if (event.getException() != null) {
sb.append("Reason: \n").append(event.getException());
}
sb.append('\n');
}
}
return sb.toString();
}
示例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);
buffer.append('\r');
out.print(buffer);
}
示例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) {
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 + ")");
}
}
示例8: 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());
}
}
示例9: 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 + ")");
}
}
示例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 )
{
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 + ")" );
}
}
示例11: 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);
}
示例12: 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
+ ")");
}
}
示例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";
}
logger.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ throughput + ")");
}
}
示例14: 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);
}
示例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) {
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 + ")");
}
}