InputStream to File

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 17:24   3070   0
oracle.sql.BLOB img_obj = (oracle.sql.BLOB) obj;
InputStream is = img_obj.getBinaryStream();
OutputStream os = new FileOutputStream(new File("new.jpg"));
int read = 0;
byte[] bytes = new byte[1024];
while((read = is.read(bytes))!= -1){
    os.write(bytes, 0, read);
}
is.close();
os.flush();
os.close();

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP