/** * Initiates a new upload request. The upload manager will decide whether to use * a single PutObject call or multi-part uploads depending on the {@link UploadConfiguration} * specified. * <p> * Note, if multi-part is used, no MD5 will be returned in the response. Also, if a multi-part * upload attempt fails, the UploadManager will attempt to abort the upload to avoid leaving * partially complete uploads and parts (unless explicitly disabled via UploadConfiguration). * * @param uploadDetails The upload request. * @return The response. * @throws BmcException if the upload fails for any reason. */ public UploadResponse upload(UploadRequest uploadDetails) { if (MultipartUtils.shouldUseMultipart( uploadConfiguration, uploadDetails.putObjectRequest.getContentLength())) { return multipartUpload(uploadDetails); } return singleUpload( uploadDetails, uploadDetails.putObjectRequest.getPutObjectBody(), uploadDetails.putObjectRequest.getContentLength()); }
if (request.getContentLength() != null) { ib.header("Content-Length", request.getContentLength());
ProgressTrackerFactory progressTrackerFactory = ProgressTrackerFactory.createMultiPartUploadProgressTrackerFactory( uploadDetails.progressReporter, request.getContentLength()); MultipartUtils.calculatePartSize(uploadConfiguration, request.getContentLength()); StreamChunkCreator chunkCreator = new StreamChunkCreator( request.getPutObjectBody(), request.getContentLength(), sizePerPart);
calculateMd5( putObjectRequest.getPutObjectBody(), putObjectRequest.getContentLength()); putObjectRequest = PutObjectRequest.builder()
/** * Copy method to populate the builder with values from the given instance. * @return this builder instance */ public Builder copy(PutObjectRequest o) { namespaceName(o.getNamespaceName()); bucketName(o.getBucketName()); objectName(o.getObjectName()); contentLength(o.getContentLength()); putObjectBody(o.getPutObjectBody()); ifMatch(o.getIfMatch()); ifNoneMatch(o.getIfNoneMatch()); opcClientRequestId(o.getOpcClientRequestId()); expect(o.getExpect()); contentMD5(o.getContentMD5()); contentType(o.getContentType()); contentLanguage(o.getContentLanguage()); contentEncoding(o.getContentEncoding()); opcMeta(o.getOpcMeta()); invocationCallback(o.getInvocationCallback()); return this; }