This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes about threads and URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "about threads and URL" Watch "about threads and URL" New topic

about threads and URL

Michael Keisu
Ranch Hand

Joined: Oct 08, 2009
Posts: 30
Hi there,
I'm using URL(and its openStream method) from Java API to retrieve data from a website, I use StringBuilder to append each HTML/source line into a String. Then use indexOf() and substring() methods to help with the actual (specific) data extraction. I wonder if there is some more efficient way to extract data from websites?

I suppose the most relevant piece of code would be:

If I have got the purpose of threads right, it is for the program to be able to execute multiple instructions at the same time rather than one at a time?
I have only just started learning threads, but I want to make use of it ASAP, to increase performance by extracting data from different places on a website at the same time. Is this a bad idea? I dont really want to put strain on servers. Is there a good way to do this?

My apologies if this belongs to beginner forum, I'm not quite sure what programming level "threads" are on.

I agree. Here's the link:
subject: about threads and URL
It's not a secret anymore!