Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-02-2007, 10:48 AM
Member
 
Join Date: Aug 2007
Posts: 15
one198 is on a distinguished road
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

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 12:13 PM. Reason: Code is placed inside [code] tag.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-02-2007, 12:13 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
What is the error message?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-02-2007, 12:29 PM
Member
 
Join Date: Aug 2007
Posts: 15
one198 is on a distinguished road
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 you

Last edited by one198 : 08-02-2007 at 01:55 PM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-02-2007, 12:37 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
There error is reporting this line:

Code:
outputChannel.write(in);
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-02-2007, 01:52 PM
Member
 
Join Date: Aug 2007
Posts: 15
one198 is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 08-02-2007, 03:46 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 08-02-2007, 05:54 PM
Member
 
Join Date: Aug 2007
Posts: 15
one198 is on a distinguished road
Offline web browser
Dear levent

Thank your for advices.I think ur web page is usefull for me.

Thank you bro
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help! swt/Browser sealyu SWT / JFace 4 07-09-2008 10:16 PM
connect JDBC to offline database nancyhung Database 1 04-12-2008 01:04 AM
how to get url from browser srinivas reddy New To Java 0 02-08-2008 09:46 AM
Eclipse RCP Browser Example JavaForums Java Blogs 0 01-02-2008 08:12 PM
how to redirect the browser simon Java Applets 1 08-02-2007 07:24 PM


All times are GMT +3. The time now is 10:35 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org