The read(byte[]) command will try to read 10 bytes at once (because your byte[] is 10 bytes). It will try to read those 10 bytes and when the inputstream is at it's end it will return -1. If less then 10 bytes can be read the read method will return the amount that can be read.
So if you follow these rules you can see why your output can be unpredictable.
You'd better do something like this:
Choon-Chern Lim
Ranch Hand
Joined: Aug 29, 2005
Posts: 74
posted
0
Instead of reading character by character, consider using bufferedReader to read the whole line.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.