private void completeMultipart ( String bucketName , String objectName , String uploadId , Part [ ] parts ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Map < String , String > queryParamMap = new HashMap <> ( ) ; queryParamMap . put ( UPLOAD_ID , uploadId ) ; CompleteMultipartUpload completeManifest = new CompleteMultipartUpload ( parts ) ; HttpResponse response = executePost ( bucketName , objectName , null , queryParamMap , completeManifest ) ; // Fixing issue https://github.com/minio/minio-java/issues/391 String bodyContent = "" ; Scanner scanner = new Scanner ( response . body ( ) . charStream ( ) ) ; try { // read entire body stream to string. scanner . useDelimiter ( "\\A" ) ; if ( scanner . hasNext ( ) ) { bodyContent = scanner . next ( ) ; } } finally { response . body ( ) . close ( ) ; scanner . close ( ) ; } bodyContent = bodyContent . trim ( ) ; if ( ! bodyContent . isEmpty ( ) ) { ErrorResponse errorResponse = new ErrorResponse ( new StringReader ( bodyContent ) ) ; if ( errorResponse . code ( ) != null ) { throw new ErrorResponseException ( errorResponse , response . response ( ) ) ; } } }
Executes complete multipart upload of given bucket name object name upload ID and parts .