Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package utils;
- import java.io.IOException;
- import java.io.OutputStream;
- import java.io.PrintStream;
- import java.io.StringReader;
- public class ClojureUtils {
- public static String eval(String text) {
- PrintStream ps = System.out;
- final StringBuffer buffer = new StringBuffer();
- PrintStream printStream = new PrintStream(new OutputStream() {
- @Override
- public void write(int b) throws IOException {
- buffer.append((char) b);
- }
- });
- System.setOut(printStream);
- clojure.lang.Compiler.load(new StringReader(text));
- System.setOut(ps);
- return buffer.toString();
- }
- static public String value = "hell2o!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement