This code takes html file as an input and converts it into the js file.
import java.io.*;
public class ChangeFileM {
public static void main(String[] args) {
try {
BufferedReader obj1 = new BufferedReader(new FileReader("c:\\terms and conditions.html"));
OutputStream os= new FileOutputStream(new File("c:\\out.js"));
PrintStream ps = new PrintStream(os);
String line;
String prefix="document.write('";
String sufix="');";
while ((line = obj1.readLine())!= null) {
line = prefix + line + sufix;
ps.println(line);
}
ps.close();
os.close();
obj1.close();
} catch (Exception e) {
}
}
}
source: java-tips.org
Thursday, April 02, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment