【发布时间】:2019-07-27 22:27:29
【问题描述】:
我需要从一个 PostgreSQL 表中读取一个图像字节数组,这样做是为了
byte[] fileBytes = resultsSet.getBytes(1);
当我尝试将其写入图像文件时,它无法打开(文件类型不受支持)。以下是代码
FileOutputStream fos = new FileOutputStream("D:\\test.png");
fos.write(fileBytes);
fos.close();
【问题讨论】:
-
"D:\\test.png"带有双反斜杠;你写了一个 tab+"est.png" -
@JoopEggen 抱歉打错了。
标签: java postgresql image fileoutputstream bytea