j ava文 件 另 存 偽
来源:互联网 发布:桌面收纳软件 编辑:程序博客网 时间:2024/05/01 16:01
public
void
downloadLocal(HttpServletResponse response, String alarmTypeName)
throws
FileNotFoundException{
// 下 载 本 地 文 件
String fileName = alarmTypeName;
fileName += (
".xls"
).toString();
try
{
fileName = URLEncoder.encode(fileName,
"UTF-8"
);
// 读 到 流 中
InputStream inStream =
new
FileInputStream(
"D://alarmTotalInfo//totalInfo.xls"
);// 文 件 路 径
// 设 置 输 出 格 式
response.reset();
response.setContentType(
"application/x-download"
);
response.setHeader(
"Content-Disposition"
,
"inline;filename ="
+ fileName);
//response.addHeader("Content-Disposition", "attachment; filename=" + fileName);
// 循 环 取 出流 中的 数 据
byte
[] b =
new
byte
[
1024
];
int
len;
try
{
OutputStream out = response.getOutputStream();
// 获 得 输 出
while
((len = inStream.read(b)) >
0
){
out.write(b,
0
, len);
}
out.flush();
out.close();
inStream.close();
}
catch
(IOException e){
e.printStackTrace();
}
}
catch
(Exception e){
e.printStackTrace();
}
}
- j ava文 件 另 存 偽
- j'ava网络通信UDP
- J ava的DA E引擎研究
- ubuntu下j在安装ava环境
- 利用J ava 实现管理信息系统中的工作流管理
- j初学ava所得一丝丝总结,望指教!!!
- j ava中Integer对象和int的区别
- android j使用JNI实现ava语言调用C语言
- linux下tomcat出现j ava.net.ConnectException: Connection refused
- J-LINK7 固件修复
- J-LINK7 固件修复
- j-link固件升级
- myeclipse中文件实心J变空心J解决办法
- J-link v8固件修复
- Keil5 J-link V8固件升级
- J-link v8固件修复
- J-link v8固件修复
- J-link V8固件升级记
- 进程
- 2012年度十大优秀免费云空间推荐
- sql 2005 日期时间 数据类型
- centos 配置nginx php-fpm mysql 环境步骤
- Delphi CxGrid 汇总(1)
- j ava文 件 另 存 偽
- Oracle与SQL Server对Update语句的处理
- ffmpeg
- Owner Draw Menu 在动态修改后文字截断的问题
- 报文分段、IP数据包、帧的长度约束
- 查看eclipse运行时JVM的内存使用情况
- oracle 10g download
- Python 替换文件内容
- 随机数