Serial Input Basics

I don't quite get recvWithStartEndMarkers(). What if a single "while Serial.available()" loop iteration finishes before the counterside has send a new character? as far as I can see, the index for the buffer is reset to 0 in each call of the function, so the buffer doesn't seem to be preservered over multiple loop() iterations?