本文整理汇总了Java中com.amazonaws.event.ProgressEvent.COMPLETED_EVENT_CODE属性的典型用法代码示例。如果您正苦于以下问题:Java ProgressEvent.COMPLETED_EVENT_CODE属性的具体用法?Java ProgressEvent.COMPLETED_EVENT_CODE怎么用?Java ProgressEvent.COMPLETED_EVENT_CODE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.amazonaws.event.ProgressEvent
的用法示例。
在下文中一共展示了ProgressEvent.COMPLETED_EVENT_CODE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: progressChanged
public void progressChanged(ProgressEvent progressEvent) {
if (progress != null) {
progress.progress();
}
// There are 3 http ops here, but this should be close enough for now
if (progressEvent.getEventCode() == ProgressEvent.PART_STARTED_EVENT_CODE ||
progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) {
statistics.incrementWriteOps(1);
}
long transferred = upload.getProgress().getBytesTransferred();
long delta = transferred - lastBytesTransferred;
if (statistics != null && delta != 0) {
statistics.incrementBytesWritten(delta);
}
lastBytesTransferred = transferred;
}
示例2: progressChanged
@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;
}
}