...
If the read()
method encounters a 0xFF
byte in the file, this value is becomes indistinguishable from the -1 value used to indicate the end of stream, because the byte value is promoted and sign-extended to an int
before being compared with -1. Consequently, the loop can will halt prematurely if a 0xFF
byte is read.
...
Related Guidelines
...