java调用Jalopy
关于jalopy的资料,我在他的官网上也没发现多少,于是自己看着他的那个主文件,写了个简单的调用出来。
import de.hunsicker.jalopy.Jalopy;
public class Call {
public static String format(String code) {
Jalopy codeFormatter = new Jalopy();
String path = "input.java";
StringBuffer output = new StringBuffer();
codeFormatter.setInput(code, path);
codeFormatter.setOutput(output);
codeFormatter.format();
return output.toString();
}
public static void main(String[] args) {
System.out.println(format("public class Test {\n"
+ " public static void main() {\n"
+ "\n"
+ " }\n"
+ " }"));
}
}