当前位置: 首页>>代码示例>>Java>>正文


Java ProgressEvent.getBytesTransferred方法代码示例

本文整理汇总了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");
		}
	}
}
 
开发者ID:ServerlessJavaMaven,项目名称:ServerlessJavaMaven,代码行数:22,代码来源:ServerlessDeployMojo.java

示例2: progressChanged

import com.amazonaws.event.ProgressEvent; //导入方法依赖的package包/类
@Override
public void progressChanged(ProgressEvent pe) {
	total += pe.getBytesTransferred();
	publishProgress(total);
	Log.i("bytestranferred:", total + "bytes");

}
 
开发者ID:jinman,项目名称:snake-game-aws,代码行数:8,代码来源:S3UploadTask.java

示例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;
  }
}
 
开发者ID:tuhrig,项目名称:DeployMan,代码行数:10,代码来源:SharpProgressListener.java

示例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);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:7,代码来源:TransferProgressUpdatingListener.java

示例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;
    }
}
 
开发者ID:stevenmhood,项目名称:transcoder,代码行数:48,代码来源:S3ProgressListener.java

示例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;			
	}
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:42,代码来源:UploadProgressListener.java


注:本文中的com.amazonaws.event.ProgressEvent.getBytesTransferred方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。