我做的程序gif下下来是乱码,望高手赐教!
BLOB blob = (BLOB) map.get( "HINGAZO ");
String fileName = (String) map.get( ".. ");
response.setContentType( "application/octet-stream ");
response.setHeader( "Content-Disposition ", "attachment; filename= " + fileName);
OutputStream os = response.getOutputStream();
OutputStreamWriter w = new OutputStreamWriter(os, "Shift_JIS ");
BufferedWriter writer = new BufferedWriter(w);
InputStream instream = blob.getBinaryStream();
int length;
while ((length = instream.read()) != -1) {
writer.write(length);
}
writer.close();
w.close();
os.close();
gif用文本打开,里面的数字和数据库中blob里的数字是一样的,就是每一行后边都有
乱码。是怎么回事啊?头一次做这方面的,很多都不懂 ,希望高手帮忙!谢谢!
------解决方案--------------------up
------解决方案--------------------gif不是图片么?