本文整理了Java中com.amazonaws.services.s3.transfer.Upload.getProgress()
方法的一些代码示例,展示了Upload.getProgress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Upload.getProgress()
方法的具体详情如下:
包路径:com.amazonaws.services.s3.transfer.Upload
类名称:Upload
方法名:getProgress
暂无
代码示例来源:origin: awsdocs/aws-doc-sdk-examples
System.out.println(" " + xfer_state);
} else {
TransferProgress progress = u.getProgress();
double pct = progress.getPercentTransferred();
printProgressBar(pct);
代码示例来源:origin: stackoverflow.com
TransferManager transferManager = new TransferManager(provider);
String bucket = "uni-cloud";
File file = new File("//sdcard//Download//cw.pdf");
if(file.exists())
{
Log.e(TAG,"File found " + file.getName());
}
else {
Log.e(TAG,"File not found");
}
Upload upload = transferManager.upload(bucket, file.getName(), file);
while (!upload.isDone()){
//Show a progress bar...
TransferProgress transferred = upload.getProgress();
Toast.makeText(this, "Uploading... ", Toast.LENGTH_LONG).show();
Log.i("Percentage", "" +transferred.getPercentTransferred());
}
Toast.makeText(this, "Uploaded", Toast.LENGTH_LONG).show();
代码示例来源:origin: org.apache.hadoop/hadoop-aws
/**
* Method to invoke after upload has completed.
* This can handle race conditions in setup/teardown.
* @return the number of bytes which were transferred after the notification
*/
public long uploadCompleted() {
long delta = upload.getProgress().getBytesTransferred() -
lastBytesTransferred;
if (delta > 0) {
LOG.debug("S3A write delta changed after finished: {} bytes", delta);
fs.incrementPutProgressStatistics(key, delta);
}
return delta;
}
代码示例来源:origin: classmethod/gradle-aws-plugin
public void progressChanged(ProgressEvent event) {
getLogger().info(" {}% uploaded", upload.getProgress().getPercentTransferred());
}
});
代码示例来源:origin: amazon-archives/aws-ant-tasks
if (printStatusUpdates) {
while (!upload.isDone()) {
System.out.print(upload.getProgress()
.getBytesTransferred()
+ "/"
+ upload.getProgress()
.getTotalBytesToTransfer()
+ " bytes transferred...\r");
Thread.sleep(statusUpdatePeriodInMs);
System.out.print(upload.getProgress()
.getBytesTransferred()
+ "/"
+ upload.getProgress()
.getTotalBytesToTransfer()
+ " bytes transferred...\n");
代码示例来源:origin: stackoverflow.com
if(item.getProgress()==100){
finalHolder.image.setAlpha(1.0f);
finalHolder.progressUpdate.setVisibility(View.GONE);
holder.play.setVisibility(View.VISIBLE);
finalHolder.progressUpdate.setProgress(item.getProgress());
代码示例来源:origin: ingenieux/beanstalker
TransferProgress xProgress = upload.getProgress();
代码示例来源:origin: ch.cern.hadoop/hadoop-aws
long delta = upload.getProgress().getBytesTransferred() - listener.getLastBytesTransferred();
if (statistics != null && delta != 0) {
if (LOG.isDebugEnabled()) {
代码示例来源:origin: FINRAOS/herd
@Override
public Upload answer(InvocationOnMock invocation) throws Throwable
{
Upload mockedUpload = mock(Upload.class);
TransferProgress transferProgress = new TransferProgress();
// bytesTransferred < totalBytesToTransfer should cause error
ReflectionTestUtils.setField(transferProgress, "bytesTransferred", 0l);
ReflectionTestUtils.setField(transferProgress, "totalBytesToTransfer", 1l);
when(mockedUpload.getProgress()).thenReturn(transferProgress);
when(mockedUpload.isDone()).thenReturn(true);
when(mockedUpload.getState()).thenReturn(TransferState.Completed);
return mockedUpload;
}
});
代码示例来源:origin: org.apache.hadoop/hadoop-aws
@Override
public void progressChanged(ProgressEvent progressEvent) {
if (progress != null) {
progress.progress();
}
// There are 3 http ops here, but this should be close enough for now
ProgressEventType pet = progressEvent.getEventType();
if (pet == TRANSFER_PART_STARTED_EVENT ||
pet == TRANSFER_COMPLETED_EVENT) {
fs.incrementWriteOperations();
}
long transferred = upload.getProgress().getBytesTransferred();
long delta = transferred - lastBytesTransferred;
fs.incrementPutProgressStatistics(key, delta);
lastBytesTransferred = transferred;
}
代码示例来源:origin: com.conveyal/r5
@Override
public void progressChanged(ProgressEvent progressEvent) {
final ProgressEventType eventType = progressEvent.getEventType();
if (eventType == ProgressEventType.REQUEST_BYTE_TRANSFER_EVENT ||
eventType == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
long now = System.currentTimeMillis();
if (now > lastLogTime + LOG_INTERVAL_SECONDS * 1000 ||
eventType == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
TransferProgress transferProgress = upload.getProgress();
double durationSec = (now - beginTime) / 1000D;
LOG.info("{} transferred {} of {} ({} percent), duration {}, speed {})",
upload.getDescription(),
human(transferProgress.getBytesTransferred(), "B"),
human(transferProgress.getTotalBytesToTransfer(), "B"),
transferProgress.getPercentTransferred(),
human(durationSec, "s"),
human(transferProgress.getBytesTransferred() / durationSec, "B/sec"));
lastLogTime = now;
}
} else if (eventType == ProgressEventType.TRANSFER_FAILED_EVENT) {
LOG.error("{}: TRANSFER FAILED.", upload.getDescription());
}
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-aws
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;
}
代码示例来源:origin: Aloisius/hadoop-s3a
long delta = upload.getProgress().getBytesTransferred() - listener.getLastBytesTransferred();
if (statistics != null && delta != 0) {
if (LOG.isDebugEnabled()) {
代码示例来源:origin: conveyal/r5
@Override
public void progressChanged(ProgressEvent progressEvent) {
final ProgressEventType eventType = progressEvent.getEventType();
if (eventType == ProgressEventType.REQUEST_BYTE_TRANSFER_EVENT ||
eventType == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
long now = System.currentTimeMillis();
if (now > lastLogTime + LOG_INTERVAL_SECONDS * 1000 ||
eventType == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
TransferProgress transferProgress = upload.getProgress();
double durationSec = (now - beginTime) / 1000D;
LOG.info("{} transferred {} of {} ({} percent), duration {}, speed {})",
upload.getDescription(),
human(transferProgress.getBytesTransferred(), "B"),
human(transferProgress.getTotalBytesToTransfer(), "B"),
transferProgress.getPercentTransferred(),
human(durationSec, "s"),
human(transferProgress.getBytesTransferred() / durationSec, "B/sec"));
lastLogTime = now;
}
} else if (eventType == ProgressEventType.TRANSFER_FAILED_EVENT) {
LOG.error("{}: TRANSFER FAILED.", upload.getDescription());
}
}
}
代码示例来源:origin: Aloisius/hadoop-s3a
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;
}
内容来源于网络,如有侵权,请联系作者删除!