Esempio n. 1
0
 public function testPointerFindsEndOfFile()
 {
     $file = new File('/file');
     $file->setData('1234567');
     $pointer = new FileHandler();
     $pointer->setFile($file);
     $pointer->seekToEnd();
     $this->assertEquals(7, $pointer->position());
 }
Esempio n. 2
0
 /**
  * Sets file pointer to specified position
  *
  * @param int $offset
  * @param int $whence
  *
  * @return bool
  */
 public function stream_seek($offset, $whence = SEEK_SET)
 {
     switch ($whence) {
         case SEEK_SET:
             $this->currently_opened->position($offset);
             break;
         case SEEK_CUR:
             $this->currently_opened->offsetPosition($offset);
             break;
         case SEEK_END:
             $this->currently_opened->seekToEnd();
             $this->currently_opened->offsetPosition($offset);
     }
     return true;
 }