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


Java IndexInput.readInt方法代码示例

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


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

示例1: loadByteField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private NumericDocValues loadByteField(FieldInfo field, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene40DocValuesFormat.INTS_CODEC_NAME,
                               Lucene40DocValuesFormat.INTS_VERSION_START,
                               Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
  int valueSize = input.readInt();
  if (valueSize != 1) {
    throw new CorruptIndexException("invalid valueSize: " + valueSize);
  }
  int maxDoc = state.segmentInfo.getDocCount();
  final byte values[] = new byte[maxDoc];
  input.readBytes(values, 0, values.length);
  ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
  return new NumericDocValues() {
    @Override
    public long get(int docID) {
      return values[docID];
    }
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:Lucene40DocValuesReader.java

示例2: loadShortField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private NumericDocValues loadShortField(FieldInfo field, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene40DocValuesFormat.INTS_CODEC_NAME,
                               Lucene40DocValuesFormat.INTS_VERSION_START,
                               Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
  int valueSize = input.readInt();
  if (valueSize != 2) {
    throw new CorruptIndexException("invalid valueSize: " + valueSize);
  }
  int maxDoc = state.segmentInfo.getDocCount();
  final short values[] = new short[maxDoc];
  for (int i = 0; i < values.length; i++) {
    values[i] = input.readShort();
  }
  ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
  return new NumericDocValues() {
    @Override
    public long get(int docID) {
      return values[docID];
    }
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Lucene40DocValuesReader.java

示例3: loadIntField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private NumericDocValues loadIntField(FieldInfo field, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene40DocValuesFormat.INTS_CODEC_NAME,
                               Lucene40DocValuesFormat.INTS_VERSION_START,
                               Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
  int valueSize = input.readInt();
  if (valueSize != 4) {
    throw new CorruptIndexException("invalid valueSize: " + valueSize);
  }
  int maxDoc = state.segmentInfo.getDocCount();
  final int values[] = new int[maxDoc];
  for (int i = 0; i < values.length; i++) {
    values[i] = input.readInt();
  }
  ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
  return new NumericDocValues() {
    @Override
    public long get(int docID) {
      return values[docID];
    }
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Lucene40DocValuesReader.java

示例4: loadLongField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private NumericDocValues loadLongField(FieldInfo field, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene40DocValuesFormat.INTS_CODEC_NAME,
                               Lucene40DocValuesFormat.INTS_VERSION_START,
                               Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
  int valueSize = input.readInt();
  if (valueSize != 8) {
    throw new CorruptIndexException("invalid valueSize: " + valueSize);
  }
  int maxDoc = state.segmentInfo.getDocCount();
  final long values[] = new long[maxDoc];
  for (int i = 0; i < values.length; i++) {
    values[i] = input.readLong();
  }
  ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
  return new NumericDocValues() {
    @Override
    public long get(int docID) {
      return values[docID];
    }
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Lucene40DocValuesReader.java

示例5: loadFloatField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private NumericDocValues loadFloatField(FieldInfo field, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene40DocValuesFormat.FLOATS_CODEC_NAME,
                               Lucene40DocValuesFormat.FLOATS_VERSION_START,
                               Lucene40DocValuesFormat.FLOATS_VERSION_CURRENT);
  int valueSize = input.readInt();
  if (valueSize != 4) {
    throw new CorruptIndexException("invalid valueSize: " + valueSize);
  }
  int maxDoc = state.segmentInfo.getDocCount();
  final int values[] = new int[maxDoc];
  for (int i = 0; i < values.length; i++) {
    values[i] = input.readInt();
  }
  ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
  return new NumericDocValues() {
    @Override
    public long get(int docID) {
      return values[docID];
    }
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Lucene40DocValuesReader.java

示例6: loadDoubleField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private NumericDocValues loadDoubleField(FieldInfo field, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene40DocValuesFormat.FLOATS_CODEC_NAME,
                               Lucene40DocValuesFormat.FLOATS_VERSION_START,
                               Lucene40DocValuesFormat.FLOATS_VERSION_CURRENT);
  int valueSize = input.readInt();
  if (valueSize != 8) {
    throw new CorruptIndexException("invalid valueSize: " + valueSize);
  }
  int maxDoc = state.segmentInfo.getDocCount();
  final long values[] = new long[maxDoc];
  for (int i = 0; i < values.length; i++) {
    values[i] = input.readLong();
  }
  ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
  return new NumericDocValues() {
    @Override
    public long get(int docID) {
      return values[docID];
    }
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Lucene40DocValuesReader.java

示例7: readUpgradedSegmentInfo

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private SegmentInfo readUpgradedSegmentInfo(String name, Directory dir, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene3xSegmentInfoFormat.UPGRADED_SI_CODEC_NAME,
                               Lucene3xSegmentInfoFormat.UPGRADED_SI_VERSION_START,
                               Lucene3xSegmentInfoFormat.UPGRADED_SI_VERSION_CURRENT);
  final Version version;
  try {
    version = Version.parse(input.readString());
  } catch (ParseException pe) {
    throw new CorruptIndexException("unable to parse version string (input: " + input + "): " + pe.getMessage(), pe);
  }

  final int docCount = input.readInt();
  
  final Map<String,String> attributes = input.readStringStringMap();

  final boolean isCompoundFile = input.readByte() == SegmentInfo.YES;

  final Map<String,String> diagnostics = input.readStringStringMap();

  final Set<String> files = input.readStringSet();

  SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile,
                                     null, diagnostics, Collections.unmodifiableMap(attributes));
  info.setFiles(files);
  return info;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:Lucene3xSegmentInfoReader.java

示例8: CompressedIndexInput

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
public CompressedIndexInput(IndexInput in) throws IOException {
    super("compressed(" + in.toString() + ")");
    this.in = in;
    readHeader(in);
    this.version = in.readInt();
    long metaDataPosition = in.readLong();
    long headerLength = in.getFilePointer();
    in.seek(metaDataPosition);
    this.totalUncompressedLength = in.readVLong();
    int size = in.readVInt();
    offsets = BigArrays.NON_RECYCLING_INSTANCE.newLongArray(size);
    for (int i = 0; i < size; i++) {
        offsets.set(i, in.readVLong());
    }
    this.currentOffsetIdx = -1;
    this.currentUncompressedChunkPointer = 0;
    in.seek(headerLength);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:CompressedIndexInput.java

示例9: init

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
public void init(IndexInput termsIn) throws IOException {

  // Make sure we are talking to the matching past writer
  CodecUtil.checkHeader(termsIn, TERMS_CODEC, VERSION_START, VERSION_CURRENT);

  skipInterval = termsIn.readInt();
  maxSkipLevels = termsIn.readInt();
  skipMinimum = termsIn.readInt();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:Lucene40PostingsReader.java

示例10: loadBytesFixedStraight

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private BinaryDocValues loadBytesFixedStraight(FieldInfo field) throws IOException {
  String fileName = IndexFileNames.segmentFileName(state.segmentInfo.name + "_" + Integer.toString(field.number), segmentSuffix, "dat");
  IndexInput input = dir.openInput(fileName, state.context);
  boolean success = false;
  try {
    CodecUtil.checkHeader(input, Lucene40DocValuesFormat.BYTES_FIXED_STRAIGHT_CODEC_NAME,
                                 Lucene40DocValuesFormat.BYTES_FIXED_STRAIGHT_VERSION_START,
                                 Lucene40DocValuesFormat.BYTES_FIXED_STRAIGHT_VERSION_CURRENT);
    final int fixedLength = input.readInt();
    PagedBytes bytes = new PagedBytes(16);
    bytes.copy(input, fixedLength * (long)state.segmentInfo.getDocCount());
    final PagedBytes.Reader bytesReader = bytes.freeze(true);
    CodecUtil.checkEOF(input);
    success = true;
    ramBytesUsed.addAndGet(bytesReader.ramBytesUsed());
    return new BinaryDocValues() {

      @Override
      public BytesRef get(int docID) {
        final BytesRef term = new BytesRef();
        bytesReader.fillSlice(term, fixedLength * (long)docID, fixedLength);
        return term;
      }
    };
  } finally {
    if (success) {
      IOUtils.close(input);
    } else {
      IOUtils.closeWhileHandlingException(input);
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:Lucene40DocValuesReader.java

示例11: loadBytesFixedSorted

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private SortedDocValues loadBytesFixedSorted(FieldInfo field, IndexInput data, IndexInput index) throws IOException {
  CodecUtil.checkHeader(data, Lucene40DocValuesFormat.BYTES_FIXED_SORTED_CODEC_NAME_DAT,
                              Lucene40DocValuesFormat.BYTES_FIXED_SORTED_VERSION_START,
                              Lucene40DocValuesFormat.BYTES_FIXED_SORTED_VERSION_CURRENT);
  CodecUtil.checkHeader(index, Lucene40DocValuesFormat.BYTES_FIXED_SORTED_CODEC_NAME_IDX,
                               Lucene40DocValuesFormat.BYTES_FIXED_SORTED_VERSION_START,
                               Lucene40DocValuesFormat.BYTES_FIXED_SORTED_VERSION_CURRENT);

  final int fixedLength = data.readInt();
  final int valueCount = index.readInt();

  PagedBytes bytes = new PagedBytes(16);
  bytes.copy(data, fixedLength * (long) valueCount);
  final PagedBytes.Reader bytesReader = bytes.freeze(true);
  final PackedInts.Reader reader = PackedInts.getReader(index);
  ramBytesUsed.addAndGet(bytesReader.ramBytesUsed() + reader.ramBytesUsed());

  return correctBuggyOrds(new SortedDocValues() {
    @Override
    public int getOrd(int docID) {
      return (int) reader.get(docID);
    }

    @Override
    public BytesRef lookupOrd(int ord) {
      final BytesRef term = new BytesRef();
      bytesReader.fillSlice(term, fixedLength * (long) ord, fixedLength);
      return term;
    }

    @Override
    public int getValueCount() {
      return valueCount;
    }
  });
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:Lucene40DocValuesReader.java

示例12: checkValidFormat

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private int checkValidFormat(IndexInput in) throws CorruptIndexException, IOException
{
  int format = in.readInt();
  if (format < FORMAT_MINIMUM)
    throw new IndexFormatTooOldException(in, format, FORMAT_MINIMUM, FORMAT_CURRENT);
  if (format > FORMAT_CURRENT)
    throw new IndexFormatTooNewException(in, format, FORMAT_MINIMUM, FORMAT_CURRENT);
  return format;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Lucene3xTermVectorsReader.java

示例13: checkCodeVersion

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
/** Verifies that the code version which wrote the segment is supported. */
public static void checkCodeVersion(Directory dir, String segment) throws IOException {
  final String indexStreamFN = IndexFileNames.segmentFileName(segment, "", FIELDS_INDEX_EXTENSION);
  IndexInput idxStream = dir.openInput(indexStreamFN, IOContext.DEFAULT);
  
  try {
    int format = idxStream.readInt();
    if (format < FORMAT_MINIMUM)
      throw new IndexFormatTooOldException(idxStream, format, FORMAT_MINIMUM, FORMAT_CURRENT);
    if (format > FORMAT_CURRENT)
      throw new IndexFormatTooNewException(idxStream, format, FORMAT_MINIMUM, FORMAT_CURRENT);
  } finally {
    idxStream.close();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:Lucene3xStoredFieldsReader.java

示例14: validateFooter

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private static void validateFooter(IndexInput in) throws IOException {
  final int magic = in.readInt();
  if (magic != FOOTER_MAGIC) {
    throw new CorruptIndexException("codec footer mismatch: actual footer=" + magic + " vs expected footer=" + FOOTER_MAGIC + " (resource: " + in + ")");
  }
  
  final int algorithmID = in.readInt();
  if (algorithmID != 0) {
    throw new CorruptIndexException("codec footer mismatch: unknown algorithmID: " + algorithmID);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:CodecUtil.java

示例15: readBits

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
/** Read as a bit set */
private void readBits(IndexInput input) throws IOException {
  count = input.readInt();        // read count
  bits = new byte[getNumBytes(size)];     // allocate bits
  input.readBytes(bits, 0, bits.length);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:BitVector.java


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