private void producePage(String src, String path, Map<String, String> vars) throws IOException { while (src.contains("[%")) { int i1 = src.indexOf("[%"); int i2 = src.substring(i1).indexOf("%]")+i1; String s1 = src.substring(0, i1); String s2 = src.substring(i1 + 2, i2).trim(); String s3 = src.substring(i2+2); String v = vars.containsKey(s2) ? vars.get(s2) : "???"; src = s1+v+s3; } TextFile.stringToFile(src, path); }
public static void stringToFile(String content, String path) throws IOException { File file = new CSFile(path); stringToFile(content, file); }
public static void stringToFile(String content, String path, boolean bom) throws IOException { File file = new CSFile(path); stringToFile(content, file, bom); }
public void addFileSource(String path, String cnt, boolean omitIfExists) throws IOException { File tmp = Utilities.createTempFile("tmp", ".tmp"); TextFile.stringToFile(cnt, tmp.getAbsolutePath()); addFileName(path, tmp.getAbsolutePath(), omitIfExists); tmp.delete(); }
private String cachedFetch(String id, String source) throws IOException { String tmpDir = System.getProperty("java.io.tmpdir"); String local = Utilities.path(tmpDir, id); File f = new File(local); if (f.exists()) return TextFile.fileToString(f); URL url = new URL(source); URLConnection c = url.openConnection(); String result = TextFile.streamToString(c.getInputStream()); TextFile.stringToFile(result, f); return result; }
s = s.replaceAll("\r\n","\n"); s = replaceSignificantEoln(s); TextFile.stringToFile(s, dest, false); new File(dest).setLastModified(time); } catch (Exception e) {
private void producePage(String src, String path, Map<String, String> vars) throws IOException { while (src.contains("[%")) { int i1 = src.indexOf("[%"); int i2 = src.substring(i1).indexOf("%]")+i1; String s1 = src.substring(0, i1); String s2 = src.substring(i1 + 2, i2).trim(); String s3 = src.substring(i2+2); String v = vars.containsKey(s2) ? vars.get(s2) : "???"; src = s1+v+s3; } TextFile.stringToFile(src, path); }
public static void stringToFile(String content, String path, boolean bom) throws IOException { File file = new CSFile(path); stringToFile(content, file, bom); }
public static void stringToFile(String content, String path) throws IOException { File file = new CSFile(path); stringToFile(content, file); }
private String cachedFetch(String id, String source) throws IOException { String tmpDir = System.getProperty("java.io.tmpdir"); String local = Utilities.path(tmpDir, id); File f = new File(local); if (f.exists()) return TextFile.fileToString(f); URL url = new URL(source); URLConnection c = url.openConnection(); String result = TextFile.streamToString(c.getInputStream()); TextFile.stringToFile(result, f); return result; }
public void addFileSource(String path, String cnt, boolean omitIfExists) throws IOException { File tmp = Utilities.createTempFile("tmp", ".tmp"); TextFile.stringToFile(cnt, tmp.getAbsolutePath()); addFileName(path, tmp.getAbsolutePath(), omitIfExists); tmp.delete(); }
s = s.replaceAll("\r\n","\n"); s = replaceSignificantEoln(s); TextFile.stringToFile(s, dest, false); new File(dest).setLastModified(time); } catch (Exception e) {