1.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/GenJS.java Wed Oct 31 15:43:39 2012 +0100
1.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/GenJS.java Thu Nov 08 18:32:32 2012 +0100
1.3 @@ -17,11 +17,8 @@
1.4 */
1.5 package org.apidesign.vm4brwsr;
1.6
1.7 -import java.io.BufferedWriter;
1.8 -import java.io.FileWriter;
1.9 import java.io.IOException;
1.10 import java.io.InputStream;
1.11 -import java.io.Writer;
1.12 import java.net.URL;
1.13 import java.util.ArrayList;
1.14 import java.util.Arrays;
1.15 @@ -41,18 +38,6 @@
1.16 final class GenJS {
1.17 private GenJS() {}
1.18
1.19 - public static void main(String... args) throws IOException {
1.20 - if (args.length < 2) {
1.21 - System.err.println("Usage: java -cp ... -jar ... <file_to_generate_js_code_to> java/lang/Class org/your/App ...");
1.22 - return;
1.23 - }
1.24 -
1.25 - Writer w = new BufferedWriter(new FileWriter(args[0]));
1.26 - List<String> classes = Arrays.asList(args).subList(1, args.length);
1.27 - compile(w, classes);
1.28 - w.close();
1.29 - }
1.30 -
1.31 static void compile(Appendable out, String... names) throws IOException {
1.32 compile(out, Arrays.asList(names));
1.33 }
1.34 @@ -197,5 +182,10 @@
1.35 }
1.36 return u.openStream();
1.37 }
1.38 -
1.39 +
1.40 + static String toString(String name) throws IOException {
1.41 + StringBuilder sb = new StringBuilder();
1.42 + compile(sb, name);
1.43 + return sb.toString().toString();
1.44 + }
1.45 }