【发布时间】:2012-02-02 05:43:50
【问题描述】:
我正在读取字节数据并将 pdf 文件写入我的 tomcat 临时文件夹
FileOutputStream fos = new FileOutputStream(File.createTempFile("dummy-file", ".pdf"));
文件写入成功。
在我的应用程序的稍后阶段,我需要能够读取该文件。我可以直接从临时文件夹中读取任何文件吗?我做不到
我在阅读时使用以下路径来引用该文件。
file:///C:/liferay-developer-studio-1.3.1/Tools/Liferay%20Developer%20Studio/liferay-portal-6.0-ee-sp2/tomcat-6.0.32/temp/dummy-file68824607895269300.pdf //these numbers are string generated randomly while writing the file.
使用此网址我看到空白结果。我假设还有另一种方法可以从临时文件夹中读取 url?还是我的网址错了?
【问题讨论】: