protected void parseFile(File javaFile) { try { filePath = javaFile.getAbsolutePath(); lastModified = javaFile.lastModified(); String name = javaFile.getName(); if (name.endsWith(".java")) { this.name = name.substring(0, name.length() - 5); } String body = FileHelper.readToString(new FileInputStream(filePath), DEFAULT_PAGE_ENCODING); parseBody(body); } catch (IOException e) { throw new RuntimeException(e); } }
public void replaceAndSave(String... fts) { String c = replace(fts); FileHelper.writeUTF8(new File(filePath), c); }