Results 1 to 1 of 1
Thread: InputStream is blocking
- 07-04-2012, 12:16 AM #1Member
- Join Date
- Jul 2012
- Rep Power
InputStream is blocking
I'm writing a program to download binary files, and my InputStream is blocking... forever.
I've created an InputStream and OutputStream, and a byte, and I'm using the byte to read a certain number of bytes at a time and write them to the OutputStream inside a loop.
Every time I run the program it runs through the loop anywhere between 100 and a few thousand times (nowhere near enough to get through a single file) and then blocks.
The offending code follows:
while((length = inputStream.read(b)) != -1)
outStream.write(b, 0, length);
I've debugged it and I know for a fact it is just waiting inside the condition cause of the while loop. I've let it sit for several minutes and it never unblocks. I know there's data there because if I type the URL of the file into a browser, the file loads just fine.
How do I jump start it again?
- By mdblack98 in forum Advanced JavaReplies: 7Last Post: 02-28-2012, 04:23 PM
- By e_scape in forum NetworkingReplies: 0Last Post: 04-12-2011, 05:18 PM
- By Singing Boyo in forum Advanced JavaReplies: 5Last Post: 06-11-2009, 10:44 AM
- By sebo in forum New To JavaReplies: 4Last Post: 12-08-2008, 12:12 PM
- By mathias in forum NetworkingReplies: 1Last Post: 08-07-2007, 06:49 AM