aspose file tools*
The moose likes I/O and Streams and the fly likes Need Help - Streaming/File IO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Need Help - Streaming/File IO" Watch "Need Help - Streaming/File IO" New topic
Author

Need Help - Streaming/File IO

Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 225
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.


The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19538
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 225
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

Joined: Oct 27, 2005
Posts: 19538
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help - Streaming/File IO
 
Similar Threads
How to use a Java class into an HTML file
Reading small -small chunks of data in a servlet???
how wirefreames communicate with Axis2(Interoperability)
How can I show new text in JTextArea while program is executing?
JSP two pages