本文整理汇总了Java中com.amazonaws.services.s3.model.ProgressListener类的典型用法代码示例。如果您正苦于以下问题:Java ProgressListener类的具体用法?Java ProgressListener怎么用?Java ProgressListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressListener类属于com.amazonaws.services.s3.model包,在下文中一共展示了ProgressListener类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: uploadToS3
import com.amazonaws.services.s3.model.ProgressListener; //导入依赖的package包/类
public static void uploadToS3(TransferManager transferManager, final File file, final FileProgressListener fileProgressListener) throws InterruptedException {
PutObjectRequest putObjectRequest = new PutObjectRequest("car-classifieds", file.getName(), file)
.withCannedAcl(CannedAccessControlList.PublicRead);
final Upload upload = transferManager.upload(putObjectRequest);
upload.addProgressListener(new ProgressListener() {
@Override
public void progressChanged(ProgressEvent progressEvent) {
fileProgressListener.onProgressChanged(progressEvent.getBytesTransferred());
if (progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) {
fileProgressListener.onCompleteUpload();
}
if (progressEvent.getEventCode() == com.amazonaws.event.ProgressEvent.STARTED_EVENT_CODE) {
fileProgressListener.onStartUpload();
}
if (progressEvent.getEventCode() == com.amazonaws.event.ProgressEvent.FAILED_EVENT_CODE) {
fileProgressListener.onFailedUpload();
}
}
});
}
开发者ID:pamu,项目名称:upman,代码行数:21,代码来源:S3Uploader.java
示例2: AWSFiscalizacaoUpload
import com.amazonaws.services.s3.model.ProgressListener; //导入依赖的package包/类
public AWSFiscalizacaoUpload(Context context,OnFiscalizacaoUploadS3PostExecuteListener listener,Fiscalizacao fiscalizacao,Integer sleep)
{
super(context);
this.listener = listener;
this.fiscalizacao = fiscalizacao;
this.sleep = sleep;
municipalities = Municipalities.getInstance(context);
mStatus = Status.IN_PROGRESS;
progressListener = new ProgressListener()
{
@Override
public void progressChanged(ProgressEvent event)
{
if(event.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE)
{
mStatus = Status.COMPLETED;
AWSFiscalizacaoUpload.this.listener.finishedFiscalizacaoUploadS3ComResultado(AWSFiscalizacaoUpload.this.fiscalizacao.getIdFiscalizacao());
}else if(event.getEventCode() == ProgressEvent.FAILED_EVENT_CODE)
{
mStatus = Status.CANCELED;
if(mUpload != null)
{
mUpload.abort();
}
AWSFiscalizacaoUpload.this.listener.finishedFiscalizacaoUploadS3ComError(AWSFiscalizacaoUpload.this.fiscalizacao.getIdFiscalizacao());
}
}
};
}
开发者ID:vocefiscal,项目名称:vocefiscal-android,代码行数:40,代码来源:AWSFiscalizacaoUpload.java
注:本文中的com.amazonaws.services.s3.model.ProgressListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论