amazon s3 - TransferManager vs PutRequestObject in AmazonS3 -
I am confused about object single uploads and multipart uploads. Both are consuming. My code below
file file = new file ("D: \ Amazon 3s Aves-Java SDK-1.8.3 \ lib \ aws-java-sdk-1.8.3 -javadoc.jar"); FileInputStream fis = New FileInputStream (file);
string keyName = System.currentTimeMillis () + "_ aws-java-sdk-1.8.3-javadoc.jar"; Object metadata metadata = new object metadata (); MetaData.addUserMetadata ("test", "test"); // Object Single Upload PutObjectRequest putobejcObjectRequest = New PutObjectRequest (BUCKET_NAME, keyName, fis, metaData); PutobejcObjectRequest.setMetadata (metadata); S3client.putObject (putobejcObjectRequest); // Object Multipurpose Upload Transfer Manager Configuration Configuration = New Transfer Manager Configuration (); Configuration.setMultipartUploadThreshold (5 * com.amazonaws.services.s3.internal.Constants.MB); Transfer Manager Transfer Manager = New Transfer Manager (S3 Client); TransferManager.setConfiguration (configuration); Upload = Upload TransferManager.upload (BUCKET_NAME, keyName, fis, metaData); Upload.waitForCompletion (); TransferManager.shutdownNow (); Please help me, there is a problem in my code.
When uploading options from a stream, callers will be able to view content in the object metadata parameter Through the length field, the size of the option must be supplied in the stream. If no content length is specified for the input stream, then the transfer manager will attempt to buffer all the stream contents into memory and upload the option as a conventional, single part upload. Because the entire stream content should be buffer in memory, it can be very expensive, and should be avoided when possible.
Source:
Comments
Post a Comment