original_string: private function _readSegmentsFile()
      {
          $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation));
  
          $format = $segmentsFile->readInt();
  
          if ($format == (int)0xFFFFFFFC) {
              $this->_formatVersion = self::FORMAT_2_3;
          } else if ($format == (int)0xFFFFFFFD) {
              $this->_formatVersion = self::FORMAT_2_1;
          } else {
              include_once 'Zend/Search/Lucene/Exception.php';
              throw new Zend_Search_Lucene_Exception('Unsupported segments file format');
          }
  
          // read version
          $segmentsFile->readLong();
  
          // read segment name counter
          $segmentsFile->readInt();
  
          $segments = $segmentsFile->readInt();
  
          $this->_docCount = 0;
  
          // read segmentInfos
          for ($count = 0; $count < $segments; $count++) {
              $segName = $segmentsFile->readString();
              $segSize = $segmentsFile->readInt();
  
              // 2.1+ specific properties
              $delGen = $segmentsFile->readLong();
  
              if ($this->_formatVersion == self::FORMAT_2_3) {
                  $docStoreOffset = $segmentsFile->readInt();
  
                  if ($docStoreOffset != (int)0xFFFFFFFF) {
                      $docStoreSegment        = $segmentsFile->readString();
                      $docStoreIsCompoundFile = $segmentsFile->readByte();
  
                      $docStoreOptions = array('offset'     => $docStoreOffset,
                                               'segment'    => $docStoreSegment,
                                               'isCompound' => ($docStoreIsCompoundFile == 1));
                  } else {
                      $docStoreOptions = null;
                  }
              } else {
                  $docStoreOptions = null;
              }
  
              $hasSingleNormFile = $segmentsFile->readByte();
              $numField          = $segmentsFile->readInt();
  
              $normGens = array();
              if ($numField != (int)0xFFFFFFFF) {
                  for ($count1 = 0; $count1 < $numField; $count1++) {
                      $normGens[] = $segmentsFile->readLong();
                  }
  
                  include_once 'Zend/Search/Lucene/Exception.php';
                  throw new Zend_Search_Lucene_Exception('Separate norm files are not supported. Optimize index to use it with Zend_Search_Lucene.');
              }
  
              $isCompoundByte     = $segmentsFile->readByte();
  
              if ($isCompoundByte == 0xFF) {
                  // The segment is not a compound file
                  $isCompound = false;
              } else if ($isCompoundByte == 0x00) {
                  // The status is unknown
                  $isCompound = null;
              } else if ($isCompoundByte == 0x01) {
                  // The segment is a compound file
                  $isCompound = true;
              }
  
              $this->_docCount += $segSize;
  
              $this->_segmentInfos[$segName] =
                                  new Zend_Search_Lucene_Index_SegmentInfo(
                                      $this->_directory,
                                      $segName,
                                      $segSize,
                                      $delGen,
                                      $docStoreOptions,
                                      $hasSingleNormFile,
                                      $isCompound
                                  );
          }
      }
code: private function _readSegmentsFile()
      {
          $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation));
  
          $format = $segmentsFile->readInt();
  
          if ($format == (int)0xFFFFFFFC) {
              $this->_formatVersion = self::FORMAT_2_3;
          } else if ($format == (int)0xFFFFFFFD) {
              $this->_formatVersion = self::FORMAT_2_1;
          } else {
              include_once 'Zend/Search/Lucene/Exception.php';
              throw new Zend_Search_Lucene_Exception('Unsupported segments file format');
          }
  
          // read version
          $segmentsFile->readLong();
  
          // read segment name counter
          $segmentsFile->readInt();
  
          $segments = $segmentsFile->readInt();
  
          $this->_docCount = 0;
  
          // read segmentInfos
          for ($count = 0; $count < $segments; $count++) {
              $segName = $segmentsFile->readString();
              $segSize = $segmentsFile->readInt();
  
              // 2.1+ specific properties
              $delGen = $segmentsFile->readLong();
  
              if ($this->_formatVersion == self::FORMAT_2_3) {
                  $docStoreOffset = $segmentsFile->readInt();
  
                  if ($docStoreOffset != (int)0xFFFFFFFF) {
                      $docStoreSegment        = $segmentsFile->readString();
                      $docStoreIsCompoundFile = $segmentsFile->readByte();
  
                      $docStoreOptions = array('offset'     => $docStoreOffset,
                                               'segment'    => $docStoreSegment,
                                               'isCompound' => ($docStoreIsCompoundFile == 1));
                  } else {
                      $docStoreOptions = null;
                  }
              } else {
                  $docStoreOptions = null;
              }
  
              $hasSingleNormFile = $segmentsFile->readByte();
              $numField          = $segmentsFile->readInt();
  
              $normGens = array();
              if ($numField != (int)0xFFFFFFFF) {
                  for ($count1 = 0; $count1 < $numField; $count1++) {
                      $normGens[] = $segmentsFile->readLong();
                  }
  
                  include_once 'Zend/Search/Lucene/Exception.php';
                  throw new Zend_Search_Lucene_Exception('Separate norm files are not supported. Optimize index to use it with Zend_Search_Lucene.');
              }
  
              $isCompoundByte     = $segmentsFile->readByte();
  
              if ($isCompoundByte == 0xFF) {
                  // The segment is not a compound file
                  $isCompound = false;
              } else if ($isCompoundByte == 0x00) {
                  // The status is unknown
                  $isCompound = null;
              } else if ($isCompoundByte == 0x01) {
                  // The segment is a compound file
                  $isCompound = true;
              }
  
              $this->_docCount += $segSize;
  
              $this->_segmentInfos[$segName] =
                                  new Zend_Search_Lucene_Index_SegmentInfo(
                                      $this->_directory,
                                      $segName,
                                      $segSize,
                                      $delGen,
                                      $docStoreOptions,
                                      $hasSingleNormFile,
                                      $isCompound
                                  );
          }
      }
code_tokens: private function _readSegmentsFile ( ) { $ segmentsFile = $ this -> _directory -> getFileObject ( self :: getSegmentFileName ( $ this -> _generation ) ) ; $ format = $ segmentsFile -> readInt ( ) ; if ( $ format == ( int ) 0xFFFFFFFC ) { $ this -> _formatVersion = self :: FORMAT_2_3 ; } else if ( $ format == ( int ) 0xFFFFFFFD ) { $ this -> _formatVersion = self :: FORMAT_2_1 ; } else { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Unsupported segments file format' ) ; } // read version $ segmentsFile -> readLong ( ) ; // read segment name counter $ segmentsFile -> readInt ( ) ; $ segments = $ segmentsFile -> readInt ( ) ; $ this -> _docCount = 0 ; // read segmentInfos for ( $ count = 0 ; $ count < $ segments ; $ count ++ ) { $ segName = $ segmentsFile -> readString ( ) ; $ segSize = $ segmentsFile -> readInt ( ) ; // 2.1+ specific properties $ delGen = $ segmentsFile -> readLong ( ) ; if ( $ this -> _formatVersion == self :: FORMAT_2_3 ) { $ docStoreOffset = $ segmentsFile -> readInt ( ) ; if ( $ docStoreOffset != ( int ) 0xFFFFFFFF ) { $ docStoreSegment = $ segmentsFile -> readString ( ) ; $ docStoreIsCompoundFile = $ segmentsFile -> readByte ( ) ; $ docStoreOptions = array ( 'offset' => $ docStoreOffset , 'segment' => $ docStoreSegment , 'isCompound' => ( $ docStoreIsCompoundFile == 1 ) ) ; } else { $ docStoreOptions = null ; } } else { $ docStoreOptions = null ; } $ hasSingleNormFile = $ segmentsFile -> readByte ( ) ; $ numField = $ segmentsFile -> readInt ( ) ; $ normGens = array ( ) ; if ( $ numField != ( int ) 0xFFFFFFFF ) { for ( $ count1 = 0 ; $ count1 < $ numField ; $ count1 ++ ) { $ normGens [ ] = $ segmentsFile -> readLong ( ) ; } include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Separate norm files are not supported. Optimize index to use it with Zend_Search_Lucene.' ) ; } $ isCompoundByte = $ segmentsFile -> readByte ( ) ; if ( $ isCompoundByte == 0xFF ) { // The segment is not a compound file $ isCompound = false ; } else if ( $ isCompoundByte == 0x00 ) { // The status is unknown $ isCompound = null ; } else if ( $ isCompoundByte == 0x01 ) { // The segment is a compound file $ isCompound = true ; } $ this -> _docCount += $ segSize ; $ this -> _segmentInfos [ $ segName ] = new Zend_Search_Lucene_Index_SegmentInfo ( $ this -> _directory , $ segName , $ segSize , $ delGen , $ docStoreOptions , $ hasSingleNormFile , $ isCompound ) ; } }
docstring: Read segments file
  
  @throws Zend_Search_Lucene_Exception
docstring_tokens: Read segments file