Results 1 to 7 of 7
Thread: Offline Web browser
- 08-02-2007, 08:48 AM #1
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
Offline Web browser
Hi guys
I developing software something like offline web browser(Teleport pro).in here what iam doing is using bufferereder i get contents of web page into reader and save it in to text file.but it give error message.
pls help me
Thank you
Java Code:import java.net.*; import java.io.*; import java.nio.channels.FileChannel; public class Test { public void main(String[] args) throws Exception { String text[]; File aFile = new File("D:\\Java\\First.text"); FileOutputStream outputFile = null; try{ outputFile = new FileOutputStream(aFile); } catch(FileNotFoundException e) { e.printStackTrace(System.err); } FileChannel outputChannel = outputFile.getChannel(); URL yahoo = new URL("http://www.yahoo.com"); URLConnection yc = yahoo.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; outputChannel.write(in); in.close(); } }Last edited by levent; 08-02-2007 at 10:13 AM. Reason: Code is placed inside [code] tag.
- 08-02-2007, 10:13 AM #2levent Guest
What is the error message?
- 08-02-2007, 10:29 AM #3
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
Offline web browser
hi guys
iam using IntellijIDE for write java codings,once i complie above codings its gives error message as below
Error(39,1),can not find symbol method write(java.io.bufferedReader)
pls help
Thank youLast edited by one198; 08-02-2007 at 11:55 AM.
- 08-02-2007, 10:37 AM #4levent Guest
There error is reporting this line:
outputChannel is an instance of FileChannel. Check javadoc of FileChannel here. It does not have a write method which has a BufferedReader parameter as reported in this error. You should send an instance of ByteBuffer to that method.Java Code:outputChannel.write(in);
- 08-02-2007, 11:52 AM #5
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
Dear levent
once i change my coding like below it gives error message.
Error ByteBuffer is abstarct class and u cant create instance Bytebuffer.
I dont know much about these topics.
pls help
coding
ByteBuffer xc=new ByteBuffer(new InputStreamReader(yc.getInputStream()));
Thank you
- 08-02-2007, 01:46 PM #6levent Guest
It seems that you can not create a bytebuffer like that. Read the javadoc please, it says you can create a bytebuffer allocating or wrapping.
I recommend you to use the downloadPage() method in the following example:
Java Tips - How to create a Search Crawler in Java
It shows a clear way of doing this. And since you will need to create some ind of crawler to download all pages on a web site, other methods might help you too.
downloadPage method in that example downloads a web page and returns it as a string. In your case, you can save the returned string to the disk or create your own method based on that example.
- 08-02-2007, 03:54 PM #7
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Need Help! swt/Browser
By sealyu in forum SWT / JFaceReplies: 4Last Post: 07-09-2008, 08:16 PM -
connect JDBC to offline database
By nancyhung in forum JDBCReplies: 1Last Post: 04-11-2008, 11:04 PM -
how to get url from browser
By srinivas reddy in forum New To JavaReplies: 0Last Post: 02-08-2008, 07:46 AM -
how to redirect the browser
By simon in forum Java AppletsReplies: 1Last Post: 08-02-2007, 05:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks