original_string: protected function _generateCFS()
      {
          $cfsFile = $this->_directory->createFile($this->_name . '.cfs');
          $cfsFile->writeVInt(count($this->_files));
  
          $dataOffsetPointers = array();
          foreach ($this->_files as $fileName) {
              $dataOffsetPointers[$fileName] = $cfsFile->tell();
              $cfsFile->writeLong(0); // write dummy data
              $cfsFile->writeString($fileName);
          }
  
          foreach ($this->_files as $fileName) {
              // Get actual data offset
              $dataOffset = $cfsFile->tell();
              // Seek to the data offset pointer
              $cfsFile->seek($dataOffsetPointers[$fileName]);
              // Write actual data offset value
              $cfsFile->writeLong($dataOffset);
              // Seek back to the end of file
              $cfsFile->seek($dataOffset);
  
              $dataFile = $this->_directory->getFileObject($fileName);
  
              $byteCount = $this->_directory->fileLength($fileName);
              while ($byteCount > 0) {
                  $data = $dataFile->readBytes(min($byteCount, 131072 /*128Kb*/));
                  $byteCount -= strlen($data);
                  $cfsFile->writeBytes($data);
              }
  
              $this->_directory->deleteFile($fileName);
          }
      }
code: protected function _generateCFS()
      {
          $cfsFile = $this->_directory->createFile($this->_name . '.cfs');
          $cfsFile->writeVInt(count($this->_files));
  
          $dataOffsetPointers = array();
          foreach ($this->_files as $fileName) {
              $dataOffsetPointers[$fileName] = $cfsFile->tell();
              $cfsFile->writeLong(0); // write dummy data
              $cfsFile->writeString($fileName);
          }
  
          foreach ($this->_files as $fileName) {
              // Get actual data offset
              $dataOffset = $cfsFile->tell();
              // Seek to the data offset pointer
              $cfsFile->seek($dataOffsetPointers[$fileName]);
              // Write actual data offset value
              $cfsFile->writeLong($dataOffset);
              // Seek back to the end of file
              $cfsFile->seek($dataOffset);
  
              $dataFile = $this->_directory->getFileObject($fileName);
  
              $byteCount = $this->_directory->fileLength($fileName);
              while ($byteCount > 0) {
                  $data = $dataFile->readBytes(min($byteCount, 131072 /*128Kb*/));
                  $byteCount -= strlen($data);
                  $cfsFile->writeBytes($data);
              }
  
              $this->_directory->deleteFile($fileName);
          }
      }
code_tokens: protected function _generateCFS ( ) { $ cfsFile = $ this -> _directory -> createFile ( $ this -> _name . '.cfs' ) ; $ cfsFile -> writeVInt ( count ( $ this -> _files ) ) ; $ dataOffsetPointers = array ( ) ; foreach ( $ this -> _files as $ fileName ) { $ dataOffsetPointers [ $ fileName ] = $ cfsFile -> tell ( ) ; $ cfsFile -> writeLong ( 0 ) ; // write dummy data $ cfsFile -> writeString ( $ fileName ) ; } foreach ( $ this -> _files as $ fileName ) { // Get actual data offset $ dataOffset = $ cfsFile -> tell ( ) ; // Seek to the data offset pointer $ cfsFile -> seek ( $ dataOffsetPointers [ $ fileName ] ) ; // Write actual data offset value $ cfsFile -> writeLong ( $ dataOffset ) ; // Seek back to the end of file $ cfsFile -> seek ( $ dataOffset ) ; $ dataFile = $ this -> _directory -> getFileObject ( $ fileName ) ; $ byteCount = $ this -> _directory -> fileLength ( $ fileName ) ; while ( $ byteCount > 0 ) { $ data = $ dataFile -> readBytes ( min ( $ byteCount , 131072 /*128Kb*/ ) ) ; $ byteCount -= strlen ( $ data ) ; $ cfsFile -> writeBytes ( $ data ) ; } $ this -> _directory -> deleteFile ( $ fileName ) ; } }
docstring: Generate compound index file
docstring_tokens: Generate compound index file