return the number of read bytes