Added support for EOF detection (byte 255) when reading