/** * 根据一个文件生成一个代码片段 * * @param f * 文件 * @return 片段对象 */ public static Segment read(File f) { String txt = Files.read(f); return new CharSegment(txt); }
public String getSubString(long pos, int length) throws SQLException { if (pos < 1) throw new SQLException("pos<1"); pos--; String str = Files.read(file); if (pos >= length) throw new IllegalArgumentException("pos="+pos); if (pos + length >= length()) return str.substring((int)pos); return str.substring((int)pos, (int)(pos + length - 1)); }
/** * 读取 UTF-8 文件全部内容 * * @param path * 文件路径 * @return 文件内容 */ public static String read(String path) { File f = Files.findFile(path); if (null == f) throw Lang.makeThrow("Can not find file '%s'", path); return read(f); }
public String getSubString(long pos, int length) throws SQLException { if (pos < 1) throw new SQLException("pos<1"); pos--; String str = Files.read(file); if (pos >= length) throw new IllegalArgumentException("pos="+pos); if (pos + length >= length()) return str.substring((int)pos); return str.substring((int)pos, (int)(pos + length - 1)); }
/** * 根据一个文件生成一个代码片段 * * @param f * 文件 * @return 片段对象 */ public static Segment read(File f) { String txt = Files.read(f); return new CharSegment(txt); }
public void visit(File file) { if (file.isDirectory()) return; System.out.println(file); String origin = Files.read(file); String output = origin.replaceAll("FZY4JW_0.ttf", "FZY4FZ_0.ttf"); if (origin.equals(output)) return; Files.write(file, output); } };
/** * 读取 UTF-8 文件全部内容 * * @param path * 文件路径 * @return 文件内容 */ public static String read(String path) { File f = Files.findFile(path); if (null == f) throw Lang.makeThrow("Can not find file '%s'", path); return read(f); }