File file = new File("image/temp.jpg");
        if(file.exists()){
   file.delete();
   file.createNewFile();
}else{
file.createNewFile();
}
             InputStream in = rs.getBinaryStream(5); //rs是连接数据库返回的ResultSet对象
FileOutputStream out = new FileOutputStream("image/temp.jpg");
byte[] bytes = new byte[1024];
int n;//将读取的文件写入到out流中
while ((n = in.read(bytes)) != -1) {
out.write(bytes, 0, n);
}
in.close();
out.close();
ImageIcon icon = new ImageIcon("image/temp.jpg");

JFrame frame = new JFrame(); JPanel panel = new JPanel();
frame.getContentPane().add(panel);
frame.getContentPane().setLayout(null); panel.setSize(400,400);
frame.setSize(400,400); panel.add(new JLabel(icon));
frame.setVisible(true);
代码的意图是将数据库的图片取出来,写入image/temp.jpg文件中,可以每次在窗体中显示的都是同一张图片,但是在硬盘里面的temp.jpg文件已经确实改变了,不知道为什么, 求助