Commit 31216dbb by zhouhaibao

[+]JAVA代码转化为可使用得节点内容

1 parent bdb4dd3f
package cn.com.glsx.process.modules.sop.java.example;
import com.alibaba.fastjson.JSONObject;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
public class JavaFileToString {
public static void main(String[] args) {
StringBuilder javaCodeBuilder = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new FileReader("F:\\360MoveData\\Users\\11\\Desktop\\企微SAAS\\2023\\09\\sop\\platform-process-server\\platform-process\\src\\main\\java\\cn\\com\\glsx\\process\\modules\\sop\\java\\example\\ControllerHttpDemo.java"))) {
String line;
while (true) {
try {
if (!((line = reader.readLine()) != null)) break;
} catch (IOException e) {
throw new RuntimeException(e);
}
javaCodeBuilder.append(line).append(System.lineSeparator());
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
String javaCode = javaCodeBuilder.toString();
Map<String,String> stringMap=new HashMap<>();
stringMap.put("source",javaCode);
// 读取Java文件内容
System.out.println("转化后结果"+ JSONObject.toJSONString(stringMap));
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!