MCPcopy Create free account
hub / github.com/0opslab/opslabJutil / sourceFile

Method sourceFile

src/main/java/com/opslab/helper/FileHelper.java:813–823  ·  view source on GitHub ↗

将BASE64的字符串恢复成文件 @param filename @param content @return

(String filename, String content)

Source from the content-addressed store, hash-verified

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的字符串

Callers

nothing calls this directly

Calls 2

decodeMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected