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; }
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(); }
/** * 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)); }