开发者

Write files to S3 through Java

I have a program which takes input from S3, generates a text file, and then sends it to the mapper class. I am unable to write the file to S3, from where the mapper can read it later. Now, I realize that we cannot write files to S3 directly, so I am trying to upload the text file created to S3 using copyFromLocalFile(). However, I get a null pointer exception in the following line:

fs.copyFromLocalFile(true, new Path(tgiPath), mapIP);

I am creating the text file in main function, so I am not sure where exactly it's being created. The only reason behind the null pointer exception, that I开发者_高级运维 can think of is that the text file is not being written on the local disk. So my question is: How do I write files on the local disk? If I just specify the name of the file while creating it, where is it created and how do I access it?


Have a look at Jets3t

This seems to be exactly what you need.


Jets3t is awesome, but I am using Google's App Engine, and it doesn't work on there because of threading limitations.

I banged my head against the wall until I came up with a solution that worked on App Engine by combining a bunch of existing libraries: http://socialappdev.com/using-amazon-s3-with-google-app-engine-02-2011

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜