所以我想克隆S3(Amazon S3)帐户上的文件夹中的对象。但我想知道是否有办法做到这一点,而不必先将文件写入本地系统,然后将该文件上传到S3?如何使用RestS3Service克隆Amazon S3中的对象
最终我希望它是完全递归克隆给定存储桶中的文件夹和对象,但现在我坚持让它克隆有效。
说水桶路径images.example.com/products/prodSku 并在prodSku文件夹我有一堆我要复制到一个新文件夹
图像这是我到目前为止所。
(注:这是写在Groovy的,但如果你知道的Java,这是同样的事情)
try{
def s3os = restService.listObjects(bucket_name, sourcePrefix, null)
def s3o
for(def i in s3os){
s3o = get(bucket_name, i.key)
// i want to be able to do something like this, just putting the input stream
// back into s3. but i can't. from what i know now, i have to write the
// dataInputStream into a file locally, then use that file to create a new S3Object
// which is placed as the second argument in the putObject method
restService.putObject(destinationBucketName, s3o.dataInputStream)
}
}catch(S3ServiceException e)
{
println e
}
对不起格式是全乱了,第一次发布的消息。
但任何帮助将不胜感激!
谢谢!
JetS3t复制示例是[here](http://jets3t.s3.amazonaws.com/toolkit/code-samples.html#copying)。 – 2011-03-12 05:03:31