本文整理汇总了Java中com.amazonaws.event.ProgressEvent.getBytesTransferred方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressEvent.getBytesTransferred方法的具体用法?Java ProgressEvent.getBytesTransferred怎么用?Java ProgressEvent.getBytesTransferred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.event.ProgressEvent
的用法示例。
在下文中一共展示了ProgressEvent.getBytesTransferred方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: progressChanged
import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
@Override
public void progressChanged(ProgressEvent event)
{
if ( event.getEventType() == ProgressEventType.REQUEST_CONTENT_LENGTH_EVENT )
{
contentLength = event.getBytes();
getLog().info("Content size: " + contentLength + " bytes");
}
else if ( event.getEventType() == ProgressEventType.REQUEST_BYTE_TRANSFER_EVENT )
{
contentSent += event.getBytesTransferred();
double div = (double) (((double)contentSent/(double)contentLength));
double mul = div*(double)100.0;
int mod = (int)mul / 10;
if ( mod > lastTenPct )
{
lastTenPct = mod;
getLog().info("Uploaded " + (mod*10) + "% of " + (contentLength/(1024*1024)) + " MB");
}
}
}
示例2: progressChanged
import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
@Override
public void progressChanged(ProgressEvent pe) {
total += pe.getBytesTransferred();
publishProgress(total);
Log.i("bytestranferred:", total + "bytes");
}
示例3: progressChanged
import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
@Override
public void progressChanged(ProgressEvent progressEvent) {
this.total += progressEvent.getBytesTransferred();
if (this.total >= this.progress) {
System.out.print("#"); //$NON-NLS-1$
this.progress += this.fraction;
}
}
示例4: progressChanged
import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
public void progressChanged(ProgressEvent progressEvent) {
long bytes = progressEvent.getBytesTransferred();
if (bytes == 0)
return; // only interested in non-zero bytes
transferProgress.updateProgress(bytes);
}
示例5: progressChanged
import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
@Override
public void progressChanged( final ProgressEvent progressEvent )
{
this.bytesTransferred += progressEvent.getBytesTransferred();
if ( this.bytesTransferred >= this.lastNotifiedBytesTransferred + ONE_MEGABYTE )
{
logger.info( "Transferring {}, {} of {} bytes complete.",
this.filename,
this.bytesTransferred,
this.fileSize );
this.lastNotifiedBytesTransferred = this.bytesTransferred;
}
switch ( progressEvent.getEventCode() )
{
case ProgressEvent.STARTED_EVENT_CODE:
logger.info( "Started transferring {}, {} of {} bytes complete.",
this.filename,
this.bytesTransferred,
this.fileSize );
break;
case ProgressEvent.PART_STARTED_EVENT_CODE:
this.partsStarted++;
logger.info( "Started transferring part {} of {}, {} of {} bytes complete.",
this.partsStarted,
this.filename,
this.bytesTransferred,
this.fileSize );
break;
case ProgressEvent.PART_COMPLETED_EVENT_CODE:
this.partsCompleted++;
logger.info( "Completed transferring part {} of {}, {} of {} bytes complete.",
this.partsCompleted,
this.filename,
this.bytesTransferred,
this.fileSize );
break;
case ProgressEvent.COMPLETED_EVENT_CODE:
logger.info( "Completed transferring {}, {} of {} bytes complete.",
this.filename,
this.bytesTransferred,
this.fileSize );
break;
}
}
示例6: processReceivedEvent
import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
private void processReceivedEvent(ProgressEvent progressEvent) {
ProgressEventType eventType = progressEvent.getEventType();
long bytesTransferred = progressEvent.getBytesTransferred();
switch(eventType) {
case REQUEST_BYTE_TRANSFER_EVENT:
done += bytesTransferred;
chunk -= bytesTransferred;
if (chunk<=0) {
logger.info(String.format("Sent %s of %s bytes", done, total));
chunk = total / CHUNK;
}
break;
case TRANSFER_COMPLETED_EVENT:
logger.info("Transfer finished");
break;
case TRANSFER_FAILED_EVENT:
logger.error("Transfer failed");
break;
case TRANSFER_STARTED_EVENT:
done = 0;
logger.info("Transfer started");
break;
case REQUEST_CONTENT_LENGTH_EVENT:
total = progressEvent.getBytes();
chunk = total / CHUNK;
logger.info("Length is " + progressEvent.getBytes());
break;
case CLIENT_REQUEST_STARTED_EVENT:
case HTTP_REQUEST_STARTED_EVENT:
case HTTP_REQUEST_COMPLETED_EVENT:
case HTTP_RESPONSE_STARTED_EVENT:
case HTTP_RESPONSE_COMPLETED_EVENT:
case CLIENT_REQUEST_SUCCESS_EVENT:
// no-op
break;
default:
logger.debug("Transfer event " + progressEvent.getEventType() + " transfered bytes was " + bytesTransferred);
break;
}
}