当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Search_Lucene_Storage_Directory::fileLength方法代码示例

本文整理汇总了PHP中Zend_Search_Lucene_Storage_Directory::fileLength方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Search_Lucene_Storage_Directory::fileLength方法的具体用法?PHP Zend_Search_Lucene_Storage_Directory::fileLength怎么用?PHP Zend_Search_Lucene_Storage_Directory::fileLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Search_Lucene_Storage_Directory的用法示例。


在下文中一共展示了Zend_Search_Lucene_Storage_Directory::fileLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _generateCFS

 /**
  * Generate compound index file
  */
 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));
             $byteCount -= strlen($data);
             $cfsFile->writeBytes($data);
         }
         $this->_directory->deleteFile($fileName);
     }
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:33,代码来源:SegmentWriter.php

示例2: _updateSegments

 /**
  * Update segments file by adding current segment to a list
  * @todo !!!!!Finish the implementation
  *
  * @throws Zend_Search_Lucene_Exception
  */
 private function _updateSegments()
 {
     $segmentsFile = $this->_directory->getFileObject('segments');
     $newSegmentFile = $this->_directory->createFile('segments.new');
     $newSegmentFile->writeInt((int) 0xffffffff);
     $newSegmentFile->writeLong($this->_version);
     $newSegmentFile->writeInt($this->_segmentNameCounter);
     $newSegmentFile->writeInt($this->_segments + count($this->_newSegments));
     $segmentsFile->seek(20);
     $newSegmentFile->writeBytes($segmentsFile->readBytes($this->_directory->fileLength('segments') - 20));
     foreach ($this->_newSegments as $segmentName => $segmentInfo) {
         $newSegmentFile->writeString($segmentName);
         $newSegmentFile->writeInt($segmentInfo->count());
     }
     $this->_directory->renameFile('segments.new', 'segments');
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:22,代码来源:Writer.php


注:本文中的Zend_Search_Lucene_Storage_Directory::fileLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。