将BASE64的字符串恢复成文件 @param filename @param content @return
(String filename, String content)
| 811 | * @return |
| 812 | */ |
| 813 | public static boolean sourceFile(String filename, String content) { |
| 814 | File file = new File(filename); |
| 815 | try (FileOutputStream fos = new FileOutputStream(file)) { |
| 816 | byte[] bytes = Base64.decode(content); |
| 817 | fos.write(bytes); |
| 818 | return true; |
| 819 | } catch (Exception e) { |
| 820 | e.printStackTrace(); |
| 821 | } |
| 822 | return false; |
| 823 | } |
| 824 | |
| 825 | /** |
| 826 | * 将文件转换为base64的字符串 |