我正在使用框提供的java sdk,我在文档中看到,如何下载文件:
String fileID = "11111";
BoxFile file = new BoxFile(api, fileID);
BoxFile.Info info = file.getInfo();
FileOutputStream stream = new FileOutputStream(info.getName());
file.download(stream);
stream.close();
我可以下载它,但它将所有内容都放在我的项目结构中,并且我想给出一个特定的路径,这样我就可以获得所有输出。
BoxFile文档不提供文件路径的属性,存储下载文件的位置。
但FileOutPutStream的API正在为此提供解决方案:
new FileOutputStream("this/path/to/my/file.txt");
您可以在https://docs.oracle.com/javase/8/docs/api/?java/io/FileOutputStream.html下找到此类构造函数的所有可能值