Ejemplo n.º 1
0
 /**
  * Creates a new instance
  *
  * @param  var $arg Either an io.File object or a file name
  * @param  text.json.Format $format
  */
 public function __construct($arg, Format $format = null)
 {
     parent::__construct($format);
     if ($arg instanceof File) {
         $this->file = $arg;
         $this->wasOpen = $this->file->isOpen();
     } else {
         $this->file = new File($arg);
         $this->wasOpen = false;
     }
     $this->wasOpen || $this->file->open(File::WRITE);
 }
Ejemplo n.º 2
0
 /**
  * Creates a new instance
  *
  * @param  io.streams.OutputStream $out
  * @param  text.json.Format $format
  */
 public function __construct(OutputStream $out, Format $format = null)
 {
     parent::__construct($format);
     $this->stream = $out;
 }