"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
Originally posted by Jim Yingst:
So, what to do? Don't use available. Period. (Except maybe for some rare cases too esoteric to get into here.) Just use the fact that the read() method by default will wait until either more data is available, or the stream closes, and will return -1 in the latter case:
Or for greater efficiency, use a buffer to read bytes in bulk:
Of course in this particular example you could just modify your shell script to read from the file directly, rather than copy the bytes to the process input stream.
[ July 05, 2005: Message edited by: Jim Yingst ][/QB]
"I'm not back." - Bill Harding, Twister
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|