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


C# IndexInput.ReadByte方法代码示例

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


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

示例1: BlockPackedReader

 /// <summary>
 /// Sole constructor. </summary>
 public BlockPackedReader(IndexInput @in, int packedIntsVersion, int blockSize, long valueCount, bool direct)
 {
     this.ValueCount = valueCount;
     BlockShift = PackedInts.CheckBlockSize(blockSize, AbstractBlockPackedWriter.MIN_BLOCK_SIZE, AbstractBlockPackedWriter.MAX_BLOCK_SIZE);
     BlockMask = blockSize - 1;
     int numBlocks = PackedInts.NumBlocks(valueCount, blockSize);
     long[] minValues = null;
     SubReaders = new PackedInts.Reader[numBlocks];
     for (int i = 0; i < numBlocks; ++i)
     {
         int token = @in.ReadByte() & 0xFF;
         int bitsPerValue = (int)((uint)token >> AbstractBlockPackedWriter.BPV_SHIFT);
         if (bitsPerValue > 64)
         {
             throw new Exception("Corrupted");
         }
         if ((token & AbstractBlockPackedWriter.MIN_VALUE_EQUALS_0) == 0)
         {
             if (minValues == null)
             {
                 minValues = new long[numBlocks];
             }
             minValues[i] = BlockPackedReaderIterator.ZigZagDecode(1L + BlockPackedReaderIterator.ReadVLong(@in));
         }
         if (bitsPerValue == 0)
         {
             SubReaders[i] = new PackedInts.NullReader(blockSize);
         }
         else
         {
             int size = (int)Math.Min(blockSize, valueCount - (long)i * blockSize);
             if (direct)
             {
                 long pointer = @in.FilePointer;
                 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:Cefa68000,项目名称:lucenenet,代码行数:47,代码来源:BlockPackedReader.cs

示例2: SkipBlock

 /// <summary>
 /// Skip the next block of data.
 /// </summary>
 /// <param name="in">      the input where to read data </param>
 /// <exception cref="IOException"> If there is a low-level I/O error </exception>
 public void SkipBlock(IndexInput @in)
 {
     int numBits = @in.ReadByte();
     if (numBits == ALL_VALUES_EQUAL)
     {
         @in.ReadVInt();
         return;
     }
     Debug.Assert(numBits > 0 && numBits <= 32, numBits.ToString());
     int encodedSize = EncodedSizes[numBits];
     @in.Seek(@in.FilePointer + encodedSize);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:17,代码来源:ForUtil.cs

示例3: ReadBlock

        /// <summary>
        /// Read the next block of data (<code>For</code> format).
        /// </summary>
        /// <param name="in">        the input to use to read data </param>
        /// <param name="encoded">   a buffer that can be used to store encoded data </param>
        /// <param name="decoded">   where to write decoded data </param>
        /// <exception cref="IOException"> If there is a low-level I/O error </exception>
        public void ReadBlock(IndexInput @in, sbyte[] encoded, int[] decoded)
        {
            int numBits = @in.ReadByte();
            Debug.Assert(numBits <= 32, numBits.ToString());

            if (numBits == ALL_VALUES_EQUAL)
            {
                int value = @in.ReadVInt();
                CollectionsHelper.Fill(decoded, 0, Lucene41PostingsFormat.BLOCK_SIZE, value);
                return;
            }

            int encodedSize = EncodedSizes[numBits];
            @in.ReadBytes(encoded, 0, encodedSize);

            PackedInts.Decoder decoder = Decoders[numBits];
            int iters = Iterations[numBits];
            Debug.Assert(iters * decoder.ByteValueCount() >= Lucene41PostingsFormat.BLOCK_SIZE);

            decoder.Decode(encoded, 0, decoded, 0, iters);
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:28,代码来源:ForUtil.cs

示例4: ReadFields

 private void ReadFields(IndexInput meta)
 {
     int fieldNumber = meta.ReadVInt();
     while (fieldNumber != -1)
     {
         int fieldType = meta.ReadByte();
         if (fieldType == NUMBER)
         {
             numerics[fieldNumber] = ReadNumericEntry(meta);
         }
         else if (fieldType == BYTES)
         {
             binaries[fieldNumber] = ReadBinaryEntry(meta);
         }
         else if (fieldType == SORTED)
         {
             sorteds[fieldNumber] = ReadSortedEntry(meta);
         }
         else if (fieldType == SORTED_SET)
         {
             sortedSets[fieldNumber] = ReadSortedSetEntry(meta);
         }
         else
         {
             throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
         }
         fieldNumber = meta.ReadVInt();
     }
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:29,代码来源:DirectDocValuesProducer.cs

示例5: ReadNumericEntry

        private static NumericEntry ReadNumericEntry(IndexInput meta)
        {
            var entry = new NumericEntry { offset = meta.ReadLong(), count = meta.ReadInt(), missingOffset = meta.ReadLong() };
            if (entry.missingOffset != -1)
            {
                entry.missingBytes = meta.ReadLong();
            }
            else
            {
                entry.missingBytes = 0;
            }
            entry.byteWidth = meta.ReadByte();

            return entry;
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:15,代码来源:DirectDocValuesProducer.cs

示例6: ReadFields

        private void ReadFields(IndexInput meta, FieldInfos infos)
        {
            int fieldNumber = meta.ReadVInt();
            while (fieldNumber != -1)
            {
                // check should be: infos.fieldInfo(fieldNumber) != null, which incorporates negative check
                // but docvalues updates are currently buggy here (loading extra stuff, etc): LUCENE-5616
                if (fieldNumber < 0)
                {
                    // 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 + ", input=" + meta);
                }
                int fieldType = meta.ReadByte();
                if (fieldType == NUMBER)
                {
                    var entry = new NumericEntry {Offset = meta.ReadLong(), Format = (sbyte)meta.ReadByte()};
                    switch (entry.Format)
                    {
                        case DELTA_COMPRESSED:
                        case TABLE_COMPRESSED:
                        case GCD_COMPRESSED:
                        case UNCOMPRESSED:
                            break;

                        default:
                            throw new CorruptIndexException("Unknown format: " + entry.Format + ", input=" + meta);
                    }
                    if (entry.Format != UNCOMPRESSED)
                    {
                        entry.PackedIntsVersion = meta.ReadVInt();
                    }
                    Numerics[fieldNumber] = entry;
                }
                else if (fieldType == BYTES)
                {
                    BinaryEntry entry = new BinaryEntry();
                    entry.Offset = meta.ReadLong();
                    entry.NumBytes = meta.ReadLong();
                    entry.MinLength = meta.ReadVInt();
                    entry.MaxLength = meta.ReadVInt();
                    if (entry.MinLength != entry.MaxLength)
                    {
                        entry.PackedIntsVersion = meta.ReadVInt();
                        entry.BlockSize = meta.ReadVInt();
                    }
                    Binaries[fieldNumber] = entry;
                }
                else if (fieldType == FST)
                {
                    FSTEntry entry = new FSTEntry();
                    entry.Offset = meta.ReadLong();
                    entry.NumOrds = meta.ReadVLong();
                    Fsts[fieldNumber] = entry;
                }
                else
                {
                    throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
                }
                fieldNumber = meta.ReadVInt();
            }
        }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:62,代码来源:Lucene42DocValuesProducer.cs

示例7: ReadFields

 private void ReadFields(IndexInput meta, FieldInfos infos)
 {
     int fieldNumber = meta.ReadVInt();
     while (fieldNumber != -1)
     {
         int fieldType = meta.ReadByte();
         if (fieldType == NUMBER)
         {
             var entry = new NumericEntry {offset = meta.ReadLong(), missingOffset = meta.ReadLong()};
             if (entry.missingOffset != -1)
             {
                 entry.missingBytes = meta.ReadLong();
             }
             else
             {
                 entry.missingBytes = 0;
             }
             entry.format = meta.ReadByte();
             switch (entry.format)
             {
                 case DELTA_COMPRESSED:
                 case TABLE_COMPRESSED:
                 case GCD_COMPRESSED:
                 case UNCOMPRESSED:
                     break;
                 default:
                     throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
             }
             if (entry.format != UNCOMPRESSED)
             {
                 entry.packedIntsVersion = meta.ReadVInt();
             }
             numerics[fieldNumber] = entry;
         }
         else if (fieldType == BYTES)
         {
             var entry = new BinaryEntry
             {
                 offset = meta.ReadLong(),
                 numBytes = meta.ReadLong(),
                 missingOffset = meta.ReadLong()
             };
             if (entry.missingOffset != -1)
             {
                 entry.missingBytes = meta.ReadLong();
             }
             else
             {
                 entry.missingBytes = 0;
             }
             entry.minLength = meta.ReadVInt();
             entry.maxLength = meta.ReadVInt();
             if (entry.minLength != entry.maxLength)
             {
                 entry.packedIntsVersion = meta.ReadVInt();
                 entry.blockSize = meta.ReadVInt();
             }
             binaries[fieldNumber] = entry;
         }
         else if (fieldType == FST)
         {
             var entry = new FSTEntry {offset = meta.ReadLong(), numOrds = meta.ReadVLong()};
             fsts[fieldNumber] = entry;
         }
         else
         {
             throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
         }
         fieldNumber = meta.ReadVInt();
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:71,代码来源:MemoryDocValuesProducer.cs


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