DataInput#read() should return -1 when the end of buffer is reached