你好, 七牛的java sdk 中默认实现了分片上传, 具体可以下载七牛sdk 源码查看 UploadManager.java
或者在github上查看, 链接如下:
https://github.com/qiniu/java...
参考源码如下:
public Response put(File file, String key, String token, StringMap params,
String mime, boolean checkCrc) throws QiniuException {
checkArgs(key, null, file, token);
if (mime == null) {
mime = Client.DefaultMime;
}
params = filterParam(params);
long size = file.length();
if (size <= configuration.putThreshold) {
return new FormUploader(client, token, key, file, params, mime, checkCrc, configuration).upload();
}
ResumeUploader uploader = new ResumeUploader(client, token, key, file,
params, mime, recorder, configuration);
return uploader.upload();
}
当文件大小 大于 4兆的时候, 会使用 ResumeUpload的 upload()方法进行上传;
在构造 UploadManager 时, 可以指定 Recorder对象, 指定 文件上传进度的存储路径