<?php
namespace nur\b\io;

/**
 * Class EOFException: exception lancée quand plus aucune donnée n'est
 * disponible sur un flux
 */
class EOFException extends IOException {
  static final function no_more_data(): self {
    return new self("no more data");
  }

  static final function ensure_not_eof($data, $eof=false) {
    if ($data !== $eof) return $data;
    else throw self::no_more_data();
  }
}