直接上代码
@RestController
public class TestController {
@RequestMapping("/file")
public void file(HttpServletResponse response) throws Exception {
// 读取文件到字节数组中
InputStream inputStream = new FileInputStream("E:\\1.txt");
byte[] bytes = new byte[1024];
// 输出文件
response.reset(