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.