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


Java IndexInput.readByte方法代码示例

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


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

示例1: readSortedField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedField(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sorted = binary + numeric
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene45DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);
  
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene45DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n = readNumericEntry(meta);
  ords.put(fieldNumber, n);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Lucene45DocValuesProducer.java

示例2: getMissingBits

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private Bits getMissingBits(final long offset) throws IOException {
  if (offset == -1) {
    return new Bits.MatchAllBits(maxDoc);
  } else {
    final IndexInput in = data.clone();
    return new Bits() {

      @Override
      public boolean get(int index) {
        try {
          in.seek(offset + (index >> 3));
          return (in.readByte() & (1 << (index & 7))) != 0;
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      @Override
      public int length() {
        return maxDoc;
      }
    };
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:Lucene45DocValuesProducer.java

示例3: readSortedField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedField(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sorted = binary + numeric
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);
  
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n = readNumericEntry(meta);
  ords.put(fieldNumber, n);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Lucene49DocValuesProducer.java

示例4: readFields

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readFields(IndexInput meta, FieldInfos infos) throws IOException {
  int fieldNumber = meta.readVInt();
  while (fieldNumber != -1) {
    FieldInfo info = infos.fieldInfo(fieldNumber);
    if (info == null) {
      throw new CorruptIndexException("Invalid field number: " + fieldNumber + " (resource=" + meta + ")");
    } else if (!info.hasNorms()) {
      throw new CorruptIndexException("Invalid field: " + info.name + " (resource=" + meta + ")");
    }
    NormsEntry entry = new NormsEntry();
    entry.format = meta.readByte();
    entry.offset = meta.readLong();
    switch(entry.format) {
      case CONST_COMPRESSED:
      case UNCOMPRESSED:
      case TABLE_COMPRESSED:
      case DELTA_COMPRESSED:
        break;
      default:
        throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
    }
    norms.put(fieldNumber, entry);
    fieldNumber = meta.readVInt();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:Lucene49NormsProducer.java

示例5: 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

示例6: readSortedField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedField(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sorted = binary + numeric
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);
  
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n = readNumericEntry(meta);
  ords.put(fieldNumber, n);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Lucene410DocValuesProducer.java

示例7: isCompressed

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
public boolean isCompressed(IndexInput in) throws IOException {
    long currentPointer = in.getFilePointer();
    // since we have some metdata before the first compressed header, we check on our specific header
    if (in.length() - currentPointer < (LUCENE_HEADER.length)) {
        return false;
    }
    for (int i = 0; i < LUCENE_HEADER.length; i++) {
        if (in.readByte() != LUCENE_HEADER[i]) {
            in.seek(currentPointer);
            return false;
        }
    }
    in.seek(currentPointer);
    return true;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:LZFCompressor.java

示例8: readSortedSetFieldWithAddresses

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedSetFieldWithAddresses(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sortedset = binary + numeric (addresses) + ordIndex
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene45DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene45DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n1 = readNumericEntry(meta);
  ords.put(fieldNumber, n1);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene45DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n2 = readNumericEntry(meta);
  ordIndexes.put(fieldNumber, n2);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:Lucene45DocValuesProducer.java

示例9: readFields

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readFields(IndexInput meta, FieldInfos infos) throws IOException {
  int fieldNumber = meta.readVInt();
  while (fieldNumber != -1) {
    if ((lenientFieldInfoCheck && fieldNumber < 0) || (!lenientFieldInfoCheck && infos.fieldInfo(fieldNumber) == null)) {
      // trickier to validate more: because we re-use for norms, because we use multiple entries
      // for "composite" types like sortedset, etc.
      throw new CorruptIndexException("Invalid field number: " + fieldNumber + " (resource=" + meta + ")");
    }
    byte type = meta.readByte();
    if (type == Lucene45DocValuesFormat.NUMERIC) {
      numerics.put(fieldNumber, readNumericEntry(meta));
    } else if (type == Lucene45DocValuesFormat.BINARY) {
      BinaryEntry b = readBinaryEntry(meta);
      binaries.put(fieldNumber, b);
    } else if (type == Lucene45DocValuesFormat.SORTED) {
      readSortedField(fieldNumber, meta, infos);
    } else if (type == Lucene45DocValuesFormat.SORTED_SET) {
      SortedSetEntry ss = readSortedSetEntry(meta);
      sortedSets.put(fieldNumber, ss);
      if (ss.format == SORTED_SET_WITH_ADDRESSES) {
        readSortedSetFieldWithAddresses(fieldNumber, meta, infos);
      } else if (ss.format == SORTED_SET_SINGLE_VALUED_SORTED) {
        if (meta.readVInt() != fieldNumber) {
          throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
        }
        if (meta.readByte() != Lucene45DocValuesFormat.SORTED) {
          throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
        }
        readSortedField(fieldNumber, meta, infos);
      } else {
        throw new AssertionError();
      }
    } else {
      throw new CorruptIndexException("invalid type: " + type + ", resource=" + meta);
    }
    fieldNumber = meta.readVInt();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:Lucene45DocValuesProducer.java

示例10: readSortedSetFieldWithAddresses

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedSetFieldWithAddresses(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sortedset = binary + numeric (addresses) + ordIndex
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n1 = readNumericEntry(meta);
  ords.put(fieldNumber, n1);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n2 = readNumericEntry(meta);
  ordIndexes.put(fieldNumber, n2);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:Lucene49DocValuesProducer.java

示例11: readSortedSetFieldWithAddresses

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedSetFieldWithAddresses(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sortedset = binary + numeric (addresses) + ordIndex
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n1 = readNumericEntry(meta);
  ords.put(fieldNumber, n1);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n2 = readNumericEntry(meta);
  ordIndexes.put(fieldNumber, n2);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:Lucene410DocValuesProducer.java

示例12: BlockPackedReader

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
/** Sole constructor. */
public BlockPackedReader(IndexInput in, int packedIntsVersion, int blockSize, long valueCount, boolean direct) throws IOException {
  this.valueCount = valueCount;
  blockShift = checkBlockSize(blockSize, MIN_BLOCK_SIZE, MAX_BLOCK_SIZE);
  blockMask = blockSize - 1;
  final int numBlocks = numBlocks(valueCount, blockSize);
  long[] minValues = null;
  subReaders = new PackedInts.Reader[numBlocks];
  for (int i = 0; i < numBlocks; ++i) {
    final int token = in.readByte() & 0xFF;
    final int bitsPerValue = token >>> BPV_SHIFT;
    if (bitsPerValue > 64) {
      throw new IOException("Corrupted");
    }
    if ((token & MIN_VALUE_EQUALS_0) == 0) {
      if (minValues == null) {
        minValues = new long[numBlocks];
      }
      minValues[i] = zigZagDecode(1L + readVLong(in));
    }
    if (bitsPerValue == 0) {
      subReaders[i] = new PackedInts.NullReader(blockSize);
    } else {
      final int size = (int) Math.min(blockSize, valueCount - (long) i * blockSize);
      if (direct) {
        final long pointer = in.getFilePointer();
        subReaders[i] = PackedInts.getDirectReaderNoHeader(in, PackedInts.Format.PACKED, packedIntsVersion, size, bitsPerValue);
        in.seek(pointer + PackedInts.Format.PACKED.byteCount(packedIntsVersion, size, bitsPerValue));
      } else {
        subReaders[i] = PackedInts.getReaderNoHeader(in, PackedInts.Format.PACKED, packedIntsVersion, size, bitsPerValue);
      }
    }
  }
  this.minValues = minValues;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:BlockPackedReader.java

示例13: randomReadAndSlice

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private byte[] randomReadAndSlice(IndexInput indexInput, int length) throws IOException {
    int readPos = (int) indexInput.getFilePointer();
    byte[] output = new byte[length];
    while (readPos < length) {
        switch (randomIntBetween(0, 3)) {
            case 0:
                // Read by one byte at a time
                output[readPos++] = indexInput.readByte();
                break;
            case 1:
                // Read several bytes into target
                int len = randomIntBetween(1, length - readPos);
                indexInput.readBytes(output, readPos, len);
                readPos += len;
                break;
            case 2:
                // Read several bytes into 0-offset target
                len = randomIntBetween(1, length - readPos);
                byte[] temp = new byte[len];
                indexInput.readBytes(temp, 0, len);
                System.arraycopy(temp, 0, output, readPos, len);
                readPos += len;
                break;
            case 3:
                // Read using slice
                len = randomIntBetween(1, length - readPos);
                IndexInput slice = indexInput.slice("slice (" + readPos + ", " + len + ") of " + indexInput.toString(), readPos, len);
                temp = randomReadAndSlice(slice, len);
                // assert that position in the original input didn't change
                assertEquals(readPos, indexInput.getFilePointer());
                System.arraycopy(temp, 0, output, readPos, len);
                readPos += len;
                indexInput.seek(readPos);
                assertEquals(readPos, indexInput.getFilePointer());
                break;
            default:
                fail();
        }
        assertEquals(readPos, indexInput.getFilePointer());
    }
    return output;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:ByteArrayIndexInputTests.java

示例14: read

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
public SegmentInfo read(Directory dir, String segment, IOContext context) throws IOException {
  final String fileName = IndexFileNames.segmentFileName(segment, "", Lucene40SegmentInfoFormat.SI_EXTENSION);
  final IndexInput input = dir.openInput(fileName, context);
  boolean success = false;
  try {
    CodecUtil.checkHeader(input, Lucene40SegmentInfoFormat.CODEC_NAME,
                                 Lucene40SegmentInfoFormat.VERSION_START,
                                 Lucene40SegmentInfoFormat.VERSION_CURRENT);
    final Version version;
    try {
      version = Version.parse(input.readString());
    } catch (ParseException pe) {
      throw new CorruptIndexException("unable to parse version string (resource=" + input + "): " + pe.getMessage(), pe);
    }

    final int docCount = input.readInt();
    if (docCount < 0) {
      throw new CorruptIndexException("invalid docCount: " + docCount + " (resource=" + input + ")");
    }
    final boolean isCompoundFile = input.readByte() == SegmentInfo.YES;
    final Map<String,String> diagnostics = input.readStringStringMap();
    input.readStringStringMap(); // read deprecated attributes
    final Set<String> files = input.readStringSet();
    
    CodecUtil.checkEOF(input);

    final SegmentInfo si = new SegmentInfo(dir, version, segment, docCount, isCompoundFile, null, diagnostics);
    si.setFiles(files);

    success = true;

    return si;

  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(input);
    } else {
      input.close();
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:Lucene40SegmentInfoReader.java

示例15: read

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
public FieldInfos read(Directory directory, String segmentName, String segmentSuffix, IOContext iocontext) throws IOException {
  final String fileName = IndexFileNames.segmentFileName(segmentName, "", Lucene40FieldInfosFormat.FIELD_INFOS_EXTENSION);
  IndexInput input = directory.openInput(fileName, iocontext);
  
  boolean success = false;
  try {
    CodecUtil.checkHeader(input, Lucene40FieldInfosFormat.CODEC_NAME, 
                                 Lucene40FieldInfosFormat.FORMAT_START, 
                                 Lucene40FieldInfosFormat.FORMAT_CURRENT);

    final int size = input.readVInt(); //read in the size
    FieldInfo infos[] = new FieldInfo[size];

    for (int i = 0; i < size; i++) {
      String name = input.readString();
      final int fieldNumber = input.readVInt();
      byte bits = input.readByte();
      boolean isIndexed = (bits & Lucene40FieldInfosFormat.IS_INDEXED) != 0;
      boolean storeTermVector = (bits & Lucene40FieldInfosFormat.STORE_TERMVECTOR) != 0;
      boolean omitNorms = (bits & Lucene40FieldInfosFormat.OMIT_NORMS) != 0;
      boolean storePayloads = (bits & Lucene40FieldInfosFormat.STORE_PAYLOADS) != 0;
      final IndexOptions indexOptions;
      if (!isIndexed) {
        indexOptions = null;
      } else if ((bits & Lucene40FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS) != 0) {
        indexOptions = IndexOptions.DOCS_ONLY;
      } else if ((bits & Lucene40FieldInfosFormat.OMIT_POSITIONS) != 0) {
        indexOptions = IndexOptions.DOCS_AND_FREQS;
      } else if ((bits & Lucene40FieldInfosFormat.STORE_OFFSETS_IN_POSTINGS) != 0) {
        indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
      } else {
        indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
      }

      // LUCENE-3027: past indices were able to write
      // storePayloads=true when omitTFAP is also true,
      // which is invalid.  We correct that, here:
      if (isIndexed && indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0) {
        storePayloads = false;
      }
      // DV Types are packed in one byte
      byte val = input.readByte();
      final LegacyDocValuesType oldValuesType = getDocValuesType((byte) (val & 0x0F));
      final LegacyDocValuesType oldNormsType = getDocValuesType((byte) ((val >>> 4) & 0x0F));
      final Map<String,String> attributes = input.readStringStringMap();;
      if (oldValuesType.mapping != null) {
        attributes.put(LEGACY_DV_TYPE_KEY, oldValuesType.name());
      }
      if (oldNormsType.mapping != null) {
        if (oldNormsType.mapping != DocValuesType.NUMERIC) {
          throw new CorruptIndexException("invalid norm type: " + oldNormsType + " (resource=" + input + ")");
        }
        attributes.put(LEGACY_NORM_TYPE_KEY, oldNormsType.name());
      }
      infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, 
        omitNorms, storePayloads, indexOptions, oldValuesType.mapping, oldNormsType.mapping, -1, Collections.unmodifiableMap(attributes));
    }

    CodecUtil.checkEOF(input);
    FieldInfos fieldInfos = new FieldInfos(infos);
    success = true;
    return fieldInfos;
  } finally {
    if (success) {
      input.close();
    } else {
      IOUtils.closeWhileHandlingException(input);
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:72,代码来源:Lucene40FieldInfosReader.java


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