base64存pdfspa
public static void base64StringToPdf(byte[] bytes,String filePath){ BufferedInputStream bis = null; FileOutputStream fos = null; BufferedOutputStream bos = null; try { //byte[] bytes = Base64.decode(base64Content, Base64..DEFAULT); ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes); bis = new BufferedInputStream(byteInputStream); File file = new File(filePath); File path = file.getParentFile(); if(!path.exists()){ path.mkdirs(); } fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); byte[] buffer = new byte[1024]; int length = bis.read(buffer); while(length != -1){ bos.write(buffer, 0, length); length = bis.read(buffer); } bos.flush(); } catch (Exception e) { e.printStackTrace(); }finally{ try { if (bis != null){ bis.close(); } if (fos != null){ fos.close(); } if (bos != null){ bos.close(); } } catch (IOException e) { e.printStackTrace(); } } }