Lines 277-282
Link Here
|
277 |
{ |
277 |
{ |
278 |
while (__bytesAvailable >= __queue.length - 1) |
278 |
while (__bytesAvailable >= __queue.length - 1) |
279 |
{ |
279 |
{ |
|
|
280 |
// The queue is full. We need to wait before adding any more data to it. Hopefully the stream owner |
281 |
// will consume some data soon! |
280 |
if(__threaded) |
282 |
if(__threaded) |
281 |
{ |
283 |
{ |
282 |
__queue.notify(); |
284 |
__queue.notify(); |
Lines 289-294
Link Here
|
289 |
throw e; |
291 |
throw e; |
290 |
} |
292 |
} |
291 |
} |
293 |
} |
|
|
294 |
else |
295 |
{ |
296 |
// We've been asked to add another character to the queue, but it is already full and there's |
297 |
// no other thread to drain it. This should not have happened! |
298 |
throw new IllegalStateException("Queue is full! Cannot process another character."); |
299 |
} |
292 |
} |
300 |
} |
293 |
|
301 |
|
294 |
// Need to do this in case we're not full, but block on a read |
302 |
// Need to do this in case we're not full, but block on a read |
Lines 389-396
Link Here
|
389 |
return (-1); |
397 |
return (-1); |
390 |
} |
398 |
} |
391 |
} |
399 |
} |
392 |
while (super.available() > 0); |
400 |
// Continue reading as long as there is data available and the queue is not full. |
393 |
|
401 |
while (super.available() > 0 && __bytesAvailable < __queue.length - 1); |
|
|
402 |
|
394 |
__readIsWaiting = false; |
403 |
__readIsWaiting = false; |
395 |
} |
404 |
} |
396 |
continue; |
405 |
continue; |