/**
* 获取录音文件 返回
*
* @param response
* @throws IOException
*/
@RequestMapping(value = "voiceFile", method = { RequestMethod.GET, RequestMethod.POST })
public void voiceFile(HttpServletRequest request,HttpServletResponse response) throws IOException{
//读取本地录音输入流
FileInputStream inputStream = new FileInputStream("c:/图片地址");
int i = inputStream.available();
//byte数组用于存放图片字节数据
byte[] buff = new byte[i];
inputStream.read(buff);
//记得关闭输入流
inputStream.close();
//设置发送到客户端的响应内容类型
response.setContentType("audio/wav");
OutputStream out = response.getOutputStream();
out.write(buff);
//关闭响应输出流
out.close();
}
}
response.setContentType("audio/wav"); wav 录音文件
response.setContentType("image/jpeg"); 图片录音文件
很多类型 查找资料