private void initMultiPartUpload ( ) throws IOException { // Generate the object metadata by setting server side encryption, md5 checksum, // and encoding as octet stream since no assumptions are made about the file type ObjectMetadata meta = new ObjectMetadata ( ) ; if ( mSseEnabled ) { meta . setSSEAlgorithm ( ObjectMetadata . AES_256_SERVER_SIDE_ENCRYPTION ) ; } if ( mHash != null ) { meta . setContentMD5 ( Base64 . encodeAsString ( mHash . digest ( ) ) ) ; } meta . setContentType ( Mimetypes . MIMETYPE_OCTET_STREAM ) ; AmazonClientException lastException ; InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest ( mBucketName , mKey ) . withObjectMetadata ( meta ) ; do { try { mUploadId = mClient . initiateMultipartUpload ( initRequest ) . getUploadId ( ) ; return ; } catch ( AmazonClientException e ) { lastException = e ; } } while ( mRetryPolicy . attempt ( ) ) ; // This point is only reached if the operation failed more // than the allowed retry count throw new IOException ( "Unable to init multipart upload to " + mKey , lastException ) ; }
Initializes multipart upload .