Esempio n. 1
0
 /**
  * Constructs the Iodophor\Io\FileWriter class with given path to the file. By
  * default the file is opened in write mode without altering its content
  * (ie r+b mode if the file exists, and wb mode if not).
  *
  * @param string $filename The path to the file.
  * @throws Iodophor\Io\Exception if the file cannot be written
  */
 public function __construct($filename, $mode = null)
 {
     if ($mode === null) {
         $mode = file_exists($filename) ? 'r+b' : 'wb';
     }
     if (($fd = fopen($filename, $mode)) === false) {
         throw new IoException('Unable to open file for writing: ' . $filename);
     }
     parent::__construct($fd);
 }
Esempio n. 2
0
 protected function writeUser(User $author, \DateTime $datetime, Writer $writer)
 {
     $writer->writeString8($author->getName());
     $writer->writeString8(" <");
     $writer->writeString8($author->getEmail());
     $writer->writeString8("> ");
     $writer->writeString8($datetime->format('U O'));
 }
Esempio n. 3
0
 /**
  * @author Magnus Nordlander
  **/
 public function writeEntryTime(Writer $writer, $time)
 {
     $writer->writeInt32BE((int) $time);
     //FIXME
     $writer->writeUInt32BE(0);
 }