public function get_contents()
 {
     $data = 'Test';
     $f = new Stream();
     $f->open(STREAM_MODE_WRITE);
     $f->write($data);
     $f->close();
     $this->assertEquals($data, FileUtil::getContents($f));
 }
 /**
  * Returns 
  *
  * @return  io.Stream
  */
 protected function archiveBytesAsStream($version = -1)
 {
     static $bytes = array(1 => "CCA", 2 => "CCA");
     $s = new Stream();
     $s->open(STREAM_WRITE);
     $s->write($bytes[$version < 0 ? $this->version() : $version]);
     $s->write(str_repeat("", 248));
     // Reserved bytes
     $s->close();
     return $s;
 }
Example #3
0
 function __construct($output = '')
 {
     $this->setOutput($output);
     parent::__construct();
 }
Example #4
0
 public function positionAfterReOpen()
 {
     $s = new Stream();
     $s->open(STREAM_MODE_WRITE);
     $s->write('GIF89a');
     $s->close();
     $s->open(STREAM_MODE_READ);
     $this->assertEquals(0, $s->tell());
     $this->assertEquals('GIF89a', $s->read());
     $s->close();
 }
Example #5
0
 /**
  * Get Thumbnail
  *
  * @return  img.Image  
  */
 public function getThumbnail()
 {
     $s = new Stream();
     $s->open(STREAM_MODE_WRITE);
     $s->write(exif_thumbnail($this->getFilename()));
     $s->rewind();
     return Image::loadFrom(new StreamReader($s));
 }