reading a file from URL and writing that file in to disk
1 posts in topic
Flat View  Flat View

Posted By:   mallika_kaukuntla
Posted On:   Sunday, January 6, 2008 05:26 AM

please give me java code for reading remote file using two or more streams parallely and writing in to disk
parallely with the help of threads

Re: reading a file from URL and writing that file in to disk

Posted By:   Robert_Lybarger  
Posted On:   Sunday, January 6, 2008 09:35 AM

Before we get that far, you will have to describe exactly how one file is going to be read by two or more streams in the first place, since that takes a fair amount of black magic on both ends of the connection to arrange that. Also, should the person answering the question assume you meant an HTTP url connection via, for example, a GET operation, or did you mean something else? (If so, what.) Then "parallely" isn't a word. (Finally, saying "please give me code to..." is not exactly conducive to getting a response from someone around here.)

What you probably mean is that you want to read the data stream of a connection (such as a connected URLConnection) in one thread, and write to a file stream using another thread. If *that* is what you mean, then using separate threads for reading and for writing won't get much farther than doing it all in the same thread... so why you want things threaded is still a bit of a mystery.

About | Sitemap | Contact