Beispiel #1
0
 /**
  * read the stream up to $count bytes
  *
  * @param   int     $count  amount of bytes to read
  * @return  string
  */
 public function stream_read($count)
 {
     if (self::WRITEONLY === $this->mode) {
         return '';
     }
     return $this->content->read($count);
 }
 /**
  * read the stream up to $count bytes
  *
  * @param   int     $count  amount of bytes to read
  * @return  string
  */
 public function stream_read($count)
 {
     if (self::WRITEONLY === $this->mode) {
         return '';
     }
     if ($this->content->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
         return '';
     }
     return $this->content->read($count);
 }
 /**
  * test reading contents from the file
  *
  * @test
  */
 public function read()
 {
     $this->file->setContent('foobarbaz');
     $this->assertFalse($this->file->eof());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals('foo', $this->file->read(3));
     $this->assertEquals(3, $this->file->getBytesRead());
     $this->assertFalse($this->file->eof());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals('bar', $this->file->read(3));
     $this->assertEquals(6, $this->file->getBytesRead());
     $this->assertFalse($this->file->eof());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals('baz', $this->file->read(3));
     $this->assertEquals(9, $this->file->getBytesRead());
     $this->assertEquals(9, $this->file->size());
     $this->assertTrue($this->file->eof());
     $this->assertEquals('', $this->file->read(3));
 }
 /**
  * read the stream up to $count bytes
  *
  * @param   int     $count  amount of bytes to read
  * @return  string
  */
 public function stream_read($count)
 {
     return $this->content->read($count);
 }