bytes read and written must be equal when copied