Alternatively you can take a look at https://github.com/minio/minio-java
Minio Java library provides simpler API's to access S3 Compatible storage providers.
In this library putObject manages file upload automatically by doing multipart internally and continues from where it left off as well.
Here is an example program.
import io.minio.MinioClient;
import io.minio.errors.ClientException;
import org.xmlpull.v1.XmlPullParserException;
import java.io.FileInputStream;
import java.io.File;
import java.io.IOException;
public class PutObject {
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
System.out.println("PutObject app");
// Set s3 endpoint, region is calculated automatically
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
File f = new File("C:/java/hello");
InputStream f = new FileInputStream(f);
// create object
s3Client.putObject("bucketName", "objectName", "application/octet-stream",
f.length(), f);
}
}
Hope this helps.