Ejemplo n.º 1
0
 /**
  * Construct a new FileInputStream.
  * @param mixed $file
  * @throws Exception - if invalid argument specified.
  * @throws IOException - if unable to open file.
  */
 public function __construct($file, $append = false)
 {
     if ($file instanceof PhingFile) {
         $this->file = $file;
     } elseif (is_string($file)) {
         $this->file = new PhingFile($file);
     } else {
         throw new Exception("Invalid argument type for \$file.");
     }
     $stream = @fopen($this->file->getAbsolutePath(), "rb");
     if ($stream === false) {
         throw new IOException("Unable to open " . $this->file->__toString() . " for reading: " . $php_errormsg);
     }
     parent::__construct($stream);
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     parent::__construct(fopen('php://stdin', 'r'));
 }