首页 > 其他分享 >安卓断点续传

安卓断点续传

时间:2023-02-24 05:55:06浏览次数:36  
标签:断点续传 TusClient 安卓 upload client file new 上传

header-icon
// 创建TusClient实例
TusClient client = new TusClient();
// 设置断点上传
client.enableResuming(new TusPreferences());
// 设置上传地址
client.setUploadCreationURL(new URL("http://example.com/files"));
// 创建文件上传
File file = new File("/path/to/file.txt");
TusUpload upload = new TusUpload(file);
// 开始上传
upload = client.upload(upload);
// 监听上传进度
upload.add TusUploader.UploadProgressListener() {
    @Override
    public void onProgress(long uploadedBytes, long totalBytes) {
        // 更新进度
    }
};
// 等待上传完成
upload.waitForUpload();

 

标签:断点续传,TusClient,安卓,upload,client,file,new,上传
From: https://www.cnblogs.com/chenKnowledgeConllection/p/17150030.html

相关文章