/** * Creates a copy of an existing S3 Object. In this signature, we will copy the * existing metadata. The default access control policy is private; if you want * to override it, please use x-amz-acl in the headers. * @param sourceBucket The name of the bucket where the source object lives. * @param sourceKey The name of the key to copy. * @param destinationBucket The name of the bucket to which the object will be added. * @param destinationKey The name of the key to use. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). You may wish to set the x-amz-acl header appropriately. */ public Response copy(String sourceBucket, String sourceKey, String destinationBucket, String destinationKey, Map headers) throws IOException { S3Object object=new S3Object(new byte[]{}, new HashMap()); headers=headers == null? new HashMap() : new HashMap(headers); headers.put("x-amz-copy-source", Collections.singletonList(sourceBucket + "/" + sourceKey)); headers.put("x-amz-metadata-directive", Collections.singletonList("COPY")); return verifyCopy(put(destinationBucket, destinationKey, object, headers)); }
/** * Creates a copy of an existing S3 Object. In this signature, we will replace the * existing metadata. The default access control policy is private; if you want * to override it, please use x-amz-acl in the headers. * @param sourceBucket The name of the bucket where the source object lives. * @param sourceKey The name of the key to copy. * @param destinationBucket The name of the bucket to which the object will be added. * @param destinationKey The name of the key to use. * @param metadata A Map of String to List of Strings representing the S3 metadata * for the new object. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). You may wish to set the x-amz-acl header appropriately. */ public Response copy(String sourceBucket, String sourceKey, String destinationBucket, String destinationKey, Map metadata, Map headers) throws IOException { S3Object object=new S3Object(new byte[]{}, metadata); headers=headers == null? new HashMap() : new HashMap(headers); headers.put("x-amz-copy-source", Collections.singletonList(sourceBucket + "/" + sourceKey)); headers.put("x-amz-metadata-directive", Collections.singletonList("REPLACE")); return verifyCopy(put(destinationBucket, destinationKey, object, headers)); }
/** * Creates a copy of an existing S3 Object. In this signature, we will copy the * existing metadata. The default access control policy is private; if you want * to override it, please use x-amz-acl in the headers. * @param sourceBucket The name of the bucket where the source object lives. * @param sourceKey The name of the key to copy. * @param destinationBucket The name of the bucket to which the object will be added. * @param destinationKey The name of the key to use. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). You may wish to set the x-amz-acl header appropriately. */ public Response copy(String sourceBucket, String sourceKey, String destinationBucket, String destinationKey, Map headers) throws IOException { S3Object object=new S3Object(new byte[]{}, new HashMap()); headers=headers == null? new HashMap() : new HashMap(headers); headers.put("x-amz-copy-source", Collections.singletonList(sourceBucket + "/" + sourceKey)); headers.put("x-amz-metadata-directive", Collections.singletonList("COPY")); return verifyCopy(put(destinationBucket, destinationKey, object, headers)); }
/** * Creates a copy of an existing S3 Object. In this signature, we will replace the * existing metadata. The default access control policy is private; if you want * to override it, please use x-amz-acl in the headers. * @param sourceBucket The name of the bucket where the source object lives. * @param sourceKey The name of the key to copy. * @param destinationBucket The name of the bucket to which the object will be added. * @param destinationKey The name of the key to use. * @param metadata A Map of String to List of Strings representing the S3 metadata * for the new object. * @param headers A Map of String to List of Strings representing the http * headers to pass (can be null). You may wish to set the x-amz-acl header appropriately. */ public Response copy(String sourceBucket, String sourceKey, String destinationBucket, String destinationKey, Map metadata, Map headers) throws IOException { S3Object object=new S3Object(new byte[]{}, metadata); headers=headers == null? new HashMap() : new HashMap(headers); headers.put("x-amz-copy-source", Collections.singletonList(sourceBucket + "/" + sourceKey)); headers.put("x-amz-metadata-directive", Collections.singletonList("REPLACE")); return verifyCopy(put(destinationBucket, destinationKey, object, headers)); }