public static void writeJS(String filename, Displayable d) throws IOException { FileWriter fw = new FileWriter(filename); StringBuilder b = new StringBuilder(65536); d.writeJS(b); fw.write(b.toString()); fw.close(); }
private static String load(String filename) throws IOException { FileReader fr = new FileReader(filename); int len = 16384; StringBuilder b = new StringBuilder(len); int charsRead; while ((charsRead = fr.read(buf)) > 0) { b.append(buf, 0, charsRead - 1); } return b.toString(); }