This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Need Help - Streaming/File IO  RSS feed

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to read from some html pages from website and need to write those html pages in given file in "chunks".

like there is some html page named .. www.somedomain.com/myinfo.html .. the page is really lengthy, so what i need to do is to create a file and write the data in it in chunks. but I am unsure about 2-3 things. Not un-sure, rather i don't know


1: how to read html page from web?
2: I need to write in file - how can i pause the constant reading stream of html page and write the read data in some file ?

Please guide.
 
Sheriff
Posts: 21560
100
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Muhammad Ali wrote:1: how to read html page from web?


Using URL and URLConnection. The latter has a method called getInputStream() - guess what that returns

2: I need to write in file - how can i pause the constant reading stream of html page and write the read data in some file ?


Simply pause reading from the InputStream.
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what do you mean "pause". That is the biggest thing confusing me? do i need to write in file through some thread or should i write in same thread? is the pause method is InputStream specific .. or i have to do it ?
 
Rob Spoor
Sheriff
Posts: 21560
100
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to do it. The InputStream will probably not transfer much data if you're not going to read from it. And if it does, you can't stop it anyway because it's an OS issue, but you still can ignore it for the time being, then read it when you're ready.
 
All of the following truths are shameless lies. But what about this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!