/** * 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; }
/** * Builds a new UploadRequest instance. The body and content length will be set on the given * request based on the original values provided when creating the builder. * * @param request The request containing all param except the body and content length. * @return A new request instance. */ public UploadRequest build(PutObjectRequest request) { String ifNoneMatch = ObjectStorageUtils.getIfNoneMatchHeader(allowOverwrite); return new UploadRequest( PutObjectRequest.builder() .copy(request) .putObjectBody(inputStream) .contentLength(contentLength) .ifNoneMatch(ifNoneMatch) .build(), parallelUploadExecutorService, allowOverwrite, progressReporter); } }