The code that reads in a frame doesn't need to check for the "eof" string. It knows the number of rows it expects in the frame (from parsing the header) and just reads that many rows, adding each to the frame. If it doesn't find enough rows (i.e., the file runs out) that is an error.
Once the frame is read, the loadSprite() method expects to find the string "end". If it doesn't, that is an error.
It knows how many frames are supposed to be in the sprite (from parsing the header), so it loops the above code the right number of times.
Once all the frames are read, the loadSprite() method exepcts to find the string "eof". If it doesn't, that is an error.
So, there is no real reason to need a "peek". After parsing the header, the loadSprite() method always knows what to expect: frame line (the right width), "end" or "eof". If it doesn't get the right string (or right sized string), it logs an error message and returns an error.