當前位置: 首頁>>代碼示例>>Java>>正文


Java IndexOutput.writeVLong方法代碼示例

本文整理匯總了Java中org.apache.lucene.store.IndexOutput.writeVLong方法的典型用法代碼示例。如果您正苦於以下問題:Java IndexOutput.writeVLong方法的具體用法?Java IndexOutput.writeVLong怎麽用?Java IndexOutput.writeVLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.lucene.store.IndexOutput的用法示例。


在下文中一共展示了IndexOutput.writeVLong方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: persist

import org.apache.lucene.store.IndexOutput; //導入方法依賴的package包/類
synchronized private void persist() throws IOException {
  String fileName = SNAPSHOTS_PREFIX + nextWriteGen;
  IndexOutput out = dir.createOutput(fileName, IOContext.DEFAULT);
  boolean success = false;
  try {
    CodecUtil.writeHeader(out, CODEC_NAME, VERSION_CURRENT);   
    out.writeVInt(refCounts.size());
    for(Entry<Long,Integer> ent : refCounts.entrySet()) {
      out.writeVLong(ent.getKey());
      out.writeVInt(ent.getValue());
    }
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(out);
      IOUtils.deleteFilesIgnoringExceptions(dir, fileName);
    } else {
      IOUtils.close(out);
    }
  }

  dir.sync(Collections.singletonList(fileName));
  
  if (nextWriteGen > 0) {
    String lastSaveFile = SNAPSHOTS_PREFIX + (nextWriteGen-1);
    // exception OK: likely it didn't exist
    IOUtils.deleteFilesIgnoringExceptions(dir, lastSaveFile);
  }

  nextWriteGen++;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:PersistentSnapshotDeletionPolicy.java

示例2: writeSkipData

import org.apache.lucene.store.IndexOutput; //導入方法依賴的package包/類
@Override
protected void writeSkipData(int level, IndexOutput skipBuffer) throws IOException {
  int delta = curDoc - lastSkipDoc[level];
  // if (DEBUG) {
  //   System.out.println("writeSkipData level=" + level + " lastDoc=" + curDoc + " delta=" + delta + " curDocPointer=" + curDocPointer);
  // }
  skipBuffer.writeVInt(delta);
  lastSkipDoc[level] = curDoc;

  skipBuffer.writeVLong(curDocPointer - lastSkipDocPointer[level]);
  lastSkipDocPointer[level] = curDocPointer;

  if (fieldHasPositions) {
    // if (DEBUG) {
    //   System.out.println("  curPosPointer=" + curPosPointer + " curPosBufferUpto=" + curPosBufferUpto);
    // }
    skipBuffer.writeVLong(curPosPointer - lastSkipPosPointer[level]);
    lastSkipPosPointer[level] = curPosPointer;
    skipBuffer.writeVInt(curPosBufferUpto);

    if (fieldHasPayloads) {
      skipBuffer.writeVInt(curPayloadByteUpto);
    }

    if (fieldHasOffsets || fieldHasPayloads) {
      skipBuffer.writeVLong(curPayPointer - lastSkipPayPointer[level]);
      lastSkipPayPointer[level] = curPayPointer;
    }
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:31,代碼來源:Lucene41SkipWriter.java


注:本文中的org.apache.lucene.store.IndexOutput.writeVLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。