• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about threads and URL

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

-Mike
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic