springmvc 向前台输出视频流
### 代码如下
```java
@RequestMapping(value = "getVideo")
public void getVideo(HttpServletRequest request, HttpServletResponse response) throws IOException {
File file = new File("e:/" + request.getParameter("name"));
try (InputStream in = new FileInputStream(file); ServletOutputStream out = response.getOutputStream();) {
int length;
byte[] buffer = new byte[4 * 1024];
// 向前台输出视频流
while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
} catch (FileNotFoundException e) {
System.out.println("文件读取失败, 文件不存在");
}
}
```