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();