如何使用 Java 读取 AWS S3 文件?
2022-09-01 12:26:31
我尝试将文件从 AWS S3 读取到我的 Java 代码中:
File file = new File("s3n://mybucket/myfile.txt");
FileInputStream fileInput = new FileInputStream(file);
然后我得到了一个错误:
java.io.FileNotFoundException: s3n:/mybucket/myfile.txt (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
有没有办法从AWS S3打开/读取文件?多谢!