提交 ea8da123 authored 作者: 许俊's avatar 许俊

修改

上级 60221a34
......@@ -29,12 +29,12 @@ public class DownLoadController {
@ApiOperation(value = "下载APK", notes = "下载APK")
@RequestMapping("/download")
public ResponseEntity<byte[]> download(HttpServletRequest request) throws IOException {
/* InputStream is=getClass().getClassLoader().getResourceAsStream("res/test.apk");*/
InputStream is=getClass().getClassLoader().getResourceAsStream("res/test.apk");
//读取文件
File file = new File("D:\\file\\test.apk");
/* File file = new File("D:\\file\\test.apk");*/
byte[] body = null;
InputStream is = new FileInputStream(file);
/* InputStream is = new FileInputStream(file);*/
body = new byte[is.available()];
is.read(body);
HttpHeaders headers = new HttpHeaders();
......@@ -53,9 +53,10 @@ public class DownLoadController {
/* InputStream is=getClass().getClassLoader().getResourceAsStream("res/test.apk");*/
response.setContentType("application/vnd.android.package-archive");
//读取文件
File file = new File("D:\\file\\test.apk");
/*File file = new File("D:\\file\\test.apk");*/
byte[] body = null;
InputStream in = new FileInputStream(file);
/*InputStream in = new FileInputStream(file);*/
InputStream in=getClass().getClassLoader().getResourceAsStream("res/test.apk");
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
//创建存放文件内容的数组
byte[] buff = new byte[1024];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论