Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要向用户打开一个 PDF 文件,该文件在 firebird 数据库中保存为 Blob。我试过了:
pdf = (File) res.getBlob("blob"); Desktop.getDesktop().open(pdf);
但它不允许我将 blob 转换为文件。这样做的理想方式是什么?
Use the blob's getBinaryStream() method to read the blob, and write the stream to a File created via createTempFile(). You can then open() the resulting File.
getBinaryStream()
File
createTempFile()
open()