To cache the whole content of the web-site
" i've read through some ex in issue155 pcplus java tutorial.Seven - eight classes are utilized ()derived for streaming web-content or file directory HTML pages.THis suggest a possible use of caching web-links to the local harddisk(copying file structure on local -pc or -server).
Well ,I modified the 4th example (Example4.java) to create a textbuffer
(when HTML page is detected) and write the URLcache to a file.The code is as follows:
String path = currentdirroot + address;
String dir = path.substring(0,path.lastIndexOf("/"));
dir.replace('/', File.separatorChar);
new File(dir).mkdirs();
FileOutputStream out = new FileOutputStream(path);
out.write(TextBuffer,0,TextBuffer.length());
out.close();
This program uses the classes derived in the issue155 tutorial ,and the classes are httpwebstream.java and page.java.Thus it creates a socket and connects (both listen and talk) to a relevant web-site via DataInputStream and Printstream.
eg
sock1 = new Socket (" 80);
in = new DatainputStream(sock1.getInputStream());
out= new PrintStream (sock1.getOutputStream());
the code for this is used in page class that detects a httpwebstream or filewebstream.While compiling javac modifiedexample4.java , compiler cannot resolve symbol write in (out.write()). write takes a string and to integers as parameters.thus by inserting the first code part in example4
the error is generated .What is wrong?Anyone who can help?
I'm most grateful of any suggestions or solutions to this matter.
" i've read through some ex in issue155 pcplus java tutorial.Seven - eight classes are utilized ()derived for streaming web-content or file directory HTML pages.THis suggest a possible use of caching web-links to the local harddisk(copying file structure on local -pc or -server).
Well ,I modified the 4th example (Example4.java) to create a textbuffer
(when HTML page is detected) and write the URLcache to a file.The code is as follows:
String path = currentdirroot + address;
String dir = path.substring(0,path.lastIndexOf("/"));
dir.replace('/', File.separatorChar);
new File(dir).mkdirs();
FileOutputStream out = new FileOutputStream(path);
out.write(TextBuffer,0,TextBuffer.length());
out.close();
This program uses the classes derived in the issue155 tutorial ,and the classes are httpwebstream.java and page.java.Thus it creates a socket and connects (both listen and talk) to a relevant web-site via DataInputStream and Printstream.
eg
sock1 = new Socket (" 80);
in = new DatainputStream(sock1.getInputStream());
out= new PrintStream (sock1.getOutputStream());
the code for this is used in page class that detects a httpwebstream or filewebstream.While compiling javac modifiedexample4.java , compiler cannot resolve symbol write in (out.write()). write takes a string and to integers as parameters.thus by inserting the first code part in example4
the error is generated .What is wrong?Anyone who can help?
I'm most grateful of any suggestions or solutions to this matter.