File f = new File("C:/huangj/InComeTimer/n.htm");
InputStreamReader read;
try {
read = new InputStreamReader(new FileInputStream(f), "UTF-8");
BufferedReader reader = new BufferedReader(read);
String line;
StringBuffer buf = new StringBuffer();
while ((line = reader.readLine()) != null) {
if (line.indexOf("$") != -1 && line.trim().equals("$")) {
buf.append(line.replaceAll("//$", content.substring(0,
content.length() - 1)));
} else {
buf.append(line);
}
buf.append("/n");
}
read.close();
reader.close();
File f1 = new File("C:/huangj/InComeTimer/n.htm");
OutputStreamWriter output;
output = new OutputStreamWriter(new FileOutputStream(f1),
"UTF-8");
output.write(buf.toString());
output.close();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}