wushuai1415.github.io's People
wushuai1415.github.io's Issues
111
// 填写Bucket名称,例如examplebucket
String bucketName = "examplebucket";
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称
String objectKey = "exampledir/exampleobject.txt";
// 下载文件路径
String downloadFilePath = "/storage/emulated/0/oss/examplefile.txt";
ResumableDownloadRequest request = new ResumableDownloadRequest(bucketName, objectKey, downloadFilePath);
// 设置分片大小
request.setPartSize(100 * 1024);
// 开启断点记录
request.setEnableCheckPoint(true);
// 设置断点记录文件路径
request.setCheckPointFilePath("/storage/emulated/0/oss");
request.setProgressListener(new OSSProgressCallback() {
@OverRide
public void onProgress(Object request, long currentSize, long totalSize) {
Log.d("ResumableDownload", "currentSize: " + currentSize + " totalSize: " + totalSize);
}
});
OSSAsyncTask task = mOss.asyncResumableDownload(request, new OSSCompletedCallback<ResumableDownloadRequest, ResumableDownloadResult>() {
@OverRide
public void onSuccess(ResumableDownloadRequest request, ResumableDownloadResult result) {
Log.d("ResumableDownload", "DownloadSuccess");
}
@OverRide
public void onFailure(ResumableDownloadRequest request, ClientException clientException, ServiceException serviceException) {
// 请求异常。
if (clientException != null) {
// 客户端异常,例如网络异常等。
clientException.printStackTrace();
}
if (serviceException != null) {
// 服务端异常。
Log.e("ErrorCode", serviceException.getErrorCode());
Log.e("RequestId", serviceException.getRequestId());
Log.e("HostId", serviceException.getHostId());
Log.e("RawMessage", serviceException.getRawMessage());
}
}
});
aaa
阿里云的oss断点下载有demo吗
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.