The only viable option there appears to be is to catch the EOFException that is
generated when we read past the end of the file. This author feels rather uneasy
about having to use this technique, since it conflicts with the fundamental ethos of
exception handling. Exception handling (as the term implies) is designed to cater
for exceptional and erroneous situations that we do not expect to happen if all goes
well and processing proceeds as planned. Here, however, we are going to be using
exception handling to detect something that we not only know will happen eventually,
but also are dependent upon happening if processing is to reach a successful
conclusion. Unfortunately, there does not appear to be any alternative to this
technique.