当前位置:   article > 正文

wav 文件下载(weblogic tomcat 可用)

wav下载
response.reset();
String fname = contact_id+".wav";
response.setHeader("content-disposition", "attachment;filename=" + fname);
BufferedOutputStream bos = null;
BufferedInputStream bis = null;
try {
url = "/ivr"+url;

System.out.println("filepath:"+url);
bis = new BufferedInputStream(new FileInputStream(url));
bos = new BufferedOutputStream(response.getOutputStream());

byte[] buff = new byte[2048];
int bytesRead;



while( (bytesRead = bis.read(buff)) > 0) {
bos.write(buff,0,bytesRead);
buff = new byte[2048];
}
} catch(final IOException e) {
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}finally {
if (bis != null)
bis.close();
if (bos != null)
{
bos.flush();
bos.close();
bos=null;
}
}
response.flushBuffer();
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/361270
推荐阅读
相关标签
  

闽ICP备14008679号