提交 483cf1f0 authored 作者: 许俊's avatar 许俊

修改

上级 48ca2809
...@@ -22,7 +22,7 @@ public class FileUtil { ...@@ -22,7 +22,7 @@ public class FileUtil {
try { try {
path = new File(ResourceUtils.getURL("classpath:").getPath()); path = new File(ResourceUtils.getURL("classpath:").getPath());
os = response.getOutputStream(); os = response.getOutputStream();
bis = new BufferedInputStream(response.getClass().getClassLoader().getResourceAsStream("res/cc.apk")); bis = new BufferedInputStream(response.getClass().getClassLoader().getResourceAsStream("res/test.apk"));
int i = bis.read(buff); int i = bis.read(buff);
while (i != -1) { while (i != -1) {
os.write(buff, 0, buff.length); os.write(buff, 0, buff.length);
......
...@@ -61,7 +61,7 @@ public class DownLoadController { ...@@ -61,7 +61,7 @@ public class DownLoadController {
/*File file = new File("D:\\file\\test.apk");*/ /*File file = new File("D:\\file\\test.apk");*/
byte[] body = null; byte[] body = null;
/*InputStream in = new FileInputStream(file);*/ /*InputStream in = new FileInputStream(file);*/
InputStream in = getClass().getClassLoader().getResourceAsStream("res/test.apk"); InputStream in = getClass().getClassLoader().getResourceAsStream("res/cc.apk");
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream()); OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
//创建存放文件内容的数组 //创建存放文件内容的数组
byte[] buff = new byte[1024]; byte[] buff = new byte[1024];
...@@ -85,7 +85,7 @@ public class DownLoadController { ...@@ -85,7 +85,7 @@ public class DownLoadController {
@RequestMapping("/download3") @RequestMapping("/download3")
@ResponseBody @ResponseBody
public void Download(HttpServletResponse response) { public void Download(HttpServletResponse response) {
String fileName = "cc.apk"; String fileName = "test.apk";
String result = FileUtil.downloadFile(response, fileName); String result = FileUtil.downloadFile(response, fileName);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论