I was intentionally being deliberate here to ensure that we don't mistake a binary file for UTF-8 by ensuring that we had the proper lead byte followed by a truncated UTF continuation byte sequence.  

False-positives are OK because we try again on the whole file later.

I think your suggestion of walking back 3 bytes to see if we find a lead byte and truncate the buffer there will work without the need for the extra if cases.