code: protected static function read_1_byte($handle)
      {
          $c = fgetc($handle);
          if ($c === false) {
              throw new \RuntimeException('Premature EOF in JPEG file', 1363533326);
          }
          return ord($c);
      }
docs: Reads one byte, testing for EOF.
  
  @param resource $handle
  @return integer
  @throws \RuntimeException