|
How to convert html file into js file |
|
|
This code takes html file as an input and converts it into the js file.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.OutputStream;
import java.io.PrintStream;
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();
//out1.close();
} catch (Exception e) {
}
}
}
|
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.