Map taxPdf = alService.getFile();//得到文件 String filestr = String.valueOf(taxPdf.get("data")); if (taxPdf != null) {BASE64Decoder decoder = new BASE64Decoder();byte[] fileBytes = decoder.decodeBuffer(filestr);HttpServletResponse response = getResponse();InputStream inputStream = null;ServletOutputStream bos = null;try {response.setHeader("content-disposition", "attachment;fileName=" + name + ".ofd");response.setContentType("application/ofd");response.setCharacterEncoding("UTF-8");bos = response.getOutputStream();// 获取ObjectinputStream = new ByteArrayInputStream(fileBytes);int ch;while ((ch = inputStream.read()) != -1) {bos.write(ch);}} catch (Exception e) {StringWriter writer = new StringWriter();e.printStackTrace(new PrintWriter(writer, true));StringBuffer logStr = new StringBuffer("\r\n\t").append("下载文件失败");} finally {if (inputStream != null) {try {inputStream.close();} catch (IOException e) {e.printStackTrace();}}if (bos != null) {try {bos.close();} catch (IOException e) {e.printStackTrace();}}} }