提交 95c4de02 authored 作者: 许俊's avatar 许俊

修改

上级 ac8284ee
......@@ -33,12 +33,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("res/test.apk");*/
//读取文件
File file = new File("res/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();
......@@ -58,10 +58,10 @@ public class DownLoadController {
/* InputStream in=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("/home/test.apk");
byte[] body = null;
/*InputStream in = new FileInputStream(file);*/
InputStream in = getClass().getClassLoader().getResourceAsStream("file/test.apk");
InputStream in = new FileInputStream(file);
/*InputStream in = getClass().getClassLoader().getResourceAsStream("file/test.apk");*/
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
//创建存放文件内容的数组
byte[] buff = new byte[1024];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论