private String initMultipartUpload(String bucketName, String objectName, Map<String, String> headerMap)
    throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
           InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
           InternalException {
    // set content type if not set already
    if (headerMap.get("Content-Type") == null) {
      headerMap.put("Content-Type", "application/octet-stream");
    }

    Map<String,String> queryParamMap = new HashMap<>();
    queryParamMap.put("uploads", "");

    HttpResponse response = executePost(bucketName, objectName, headerMap, queryParamMap, "");

    InitiateMultipartUploadResult result = new InitiateMultipartUploadResult();
    result.parseXml(response.body().charStream());
    response.body().close();
    return result.uploadId();
  }
private String initMultipartUpload ( String bucketName , String objectName , Map < String , String > headerMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { if ( headerMap . get ( "Content-Type" ) == null ) { headerMap . put ( "Content-Type" , "application/octet-stream" ) ; } Map < String , String > queryParamMap = new HashMap < > ( ) ; queryParamMap . put ( "uploads" , "" ) ; HttpResponse response = executePost ( bucketName , objectName , headerMap , queryParamMap , "" ) ; InitiateMultipartUploadResult result = new InitiateMultipartUploadResult ( ) ; result . parseXml ( response . body ( ) . charStream ( ) ) ; response . body ( ) . close ( ) ; return result . uploadId ( ) ; }
Initializes new multipart upload for given bucket name, object name and content type.