����JFIFHH��XExifMM*�i&������8Photoshop 3.08BIM8BIM%��ُ�� ���B~���"�� ���s!1"AQ2aq#� �B�R3�$b0�r�C�4��S@%c5�s�PD���&T6d�t�`҄�p�'E7e�Uu��Å��Fv��GVf� ()*89:HIJWXYZghijwxyz����������������������������������������������������������� ����! 1A0"2Q@3#aBqR4�P$��C�b5S��%`�D�r��c6p&ET�'�� ()*789:FGHIJUVWXYZdefghijstuvwxyz�����������������������������������������������������������������������������C """"""''''',,,,,,,,,,��C ...................................................���ΛN�m�!Q@i���dV�Vk����ƍ:�gTNննն���m�m��N�i�i��Ӫ4�N�4iնմ�:1�V���h�[i�m5uD���:�gV�TNն�;j�:���i��j�j�Q;V�m�Dꍦ�Li��j�am��NѝN��e��0-8R U�]L��MLN��TiմMm�m��LT��1[LT��;hFڶڶڶ�Ѵ�t�ڶڶڶڴ���TN�um[mZv������*vնմ��j�j�j��m�m��m[mS�i��cm�m�m�m�m�m�m�3��f�n� ���{a�iզ5Nڶڶڶڶ���5b�h��5������m��ն��1[m[mS�h���m�m�m��Љ���V�V�V�V�T��LMm�m�m:�N��&�ڶڶ�Q;V�Tm�m5�FڴN������P���b�LTi��b��[mS��m�v��MD���5�j��m�m�v���������a�MD�Ii���B�m����j�5N���0��J�;j����5�5N�Q�V�km�m�m�m�m�m�m5�նբuh�Q�*th��6ڴN��ut tMDN���ն�11Zv��h���`������(i��{�$�*62ٴ����
后台代码
String lawid=this.getServletRequest().getParameter("lawid");
LawSm lawSm=lawSmService.getById(lawid);
String fpath = lawSm.getFpath();
if(fpath.contains(".pdf")){
HttpServletRequest request = super.getServletRequest();
String realPath = request.getSession().getServletContext().getRealPath("/flfgUpload/");
PdfToImage.pdfToImage(realPath+"\\"+fpath);
String fpathTemplate = fpath.replaceAll(".pdf", ".png");
FileInputStream fis = null;
this.getServletResponse().setContentType("image/jpeg");
OutputStream out = this.getServletResponse().getOutputStream();
File file = new File(realPath+"\\"+fpathTemplate);
fis = new FileInputStream(file);
byte[] b = new byte[fis.available()];
fis.read(b);
out.write(b);
out.flush();
}else{
String contentType=initContenType(lawSm.getFileName());
if(StringUtils.isNotEmpty(contentType)) {
this.getServletResponse().setContentType(contentType);
}
this.getServletResponse().setBufferSize(4096);
try {
byte[] buf = lawSm.getLawaffix();
if(buf == null || buf.length == 0) {
super.getServletResponse().getWriter().write("<h4 align=\"center\">该政策法规条目未上传任何文本附件,暂无法查看,请导入相关文本附件!</h4>");
return null;
}
OutputStream outStream = this.getServletResponse().getOutputStream();
this.getServletResponse().setCharacterEncoding("GB2312");
outStream.write(buf,0,buf.length);
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
问题已经解决,要对输出流进行Base64编码,将上面代码中已经含有值得 byte[] b 数组进行编码
b = Base64.encodeBase64(b);