• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Store.IndexInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IndexInput类属于Lucene.Net.Store命名空间,在下文中一共展示了IndexInput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetAddressInstance

 protected override MonotonicBlockPackedReader GetAddressInstance(IndexInput data, FieldInfo field,
     BinaryEntry bytes)
 {
     data.Seek(bytes.AddressesOffset);
     return new MonotonicBlockPackedReader((IndexInput)data.Clone(), bytes.PackedIntsVersion, bytes.BlockSize, bytes.Count,
         true);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:7,代码来源:DiskDocValuesProducer.cs


示例2: MockSingleIntIndexInput

 public MockSingleIntIndexInput(Directory dir, string fileName, IOContext context)
 {
     @in = dir.OpenInput(fileName, context);
     CodecUtil.CheckHeader(@in, MockSingleIntIndexOutput.CODEC,
                   MockSingleIntIndexOutput.VERSION_START,
                   MockSingleIntIndexOutput.VERSION_START);
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:7,代码来源:MockSingleIntIndexInput.cs


示例3: GetOrdIndexInstance

 protected override MonotonicBlockPackedReader GetOrdIndexInstance(IndexInput data, FieldInfo field,
     NumericEntry entry)
 {
     data.Seek(entry.Offset);
     return new MonotonicBlockPackedReader((IndexInput)data.Clone(), entry.PackedIntsVersion, entry.BlockSize, entry.Count,
         true);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:7,代码来源:DiskDocValuesProducer.cs


示例4: CheckEOF

 /// <summary>
 /// Checks that the stream is positioned at the end, and throws exception
 /// if it is not. </summary>
 /// @deprecated Use <seealso cref="#checkFooter"/> instead, this should only used for files without checksums
 public static void CheckEOF(IndexInput @in)
 {
     if (@in.FilePointer != @in.Length())
     {
         throw new System.IO.IOException("did not read all bytes from file: read " + @in.FilePointer + " vs size " + @in.Length() + " (resource: " + @in + ")");
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:CodecUtil.cs


示例5: MockIndexInputWrapper

 /// <summary>
 /// Construct an empty output buffer. </summary>
 public MockIndexInputWrapper(MockDirectoryWrapper dir, string name, IndexInput @delegate)
     : base("MockIndexInputWrapper(name=" + name + " delegate=" + @delegate + ")")
 {
     this.Name = name;
     this.Dir = dir;
     [email protected] = @delegate;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:9,代码来源:MockIndexInputWrapper.cs


示例6: IsSimpleFSIndexInputClone

 /// <summary>
 /// Returns true if the provided input stream is an SimpleFSIndexInput and
 ///  is a clone, that is it does not own its underlying file descriptor.
 /// </summary>
 public static bool IsSimpleFSIndexInputClone(IndexInput @is)
 {
     if (IsSimpleFSIndexInput(@is))
     {
         return ((SimpleFSIndexInput)@is).IsClone;
     }
     else
     {
         return false;
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:15,代码来源:TestHelper.cs


示例7: IsSimpleFSIndexInputClone

		/// <summary>Returns true if the provided input stream is an SimpleFSIndexInput and
		/// is a clone, that is it does not own its underlying file descriptor.
		/// </summary>
		public static bool IsSimpleFSIndexInputClone(IndexInput is_Renamed)
		{
			if (IsSimpleFSIndexInput(is_Renamed))
			{
				return ((SimpleFSIndexInput) is_Renamed).isClone_ForNUnit;
			}
			else
			{
				return false;
			}
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:14,代码来源:_TestHelper.cs


示例8: IsSimpleFSIndexInputOpen

		/// <summary>Given an instance of SimpleFSDirectory.SimpleFSIndexInput, this method returns
		/// true if the underlying file descriptor is valid, and false otherwise.
		/// This can be used to determine if the OS file has been closed.
		/// The descriptor becomes invalid when the non-clone instance of the
		/// SimpleFSIndexInput that owns this descriptor is closed. However, the
		/// descriptor may possibly become invalid in other ways as well.
		/// </summary>
		public static bool IsSimpleFSIndexInputOpen(IndexInput is_Renamed)
		{
			if (IsSimpleFSIndexInput(is_Renamed))
			{
				SimpleFSIndexInput fis = (SimpleFSIndexInput) is_Renamed;
				return fis.IsFDValid();
			}
			else
			{
				return false;
			}
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:19,代码来源:_TestHelper.cs


示例9: IsSimpleFSIndexInputOpen

 /// <summary>
 /// Given an instance of SimpleFSDirectory.SimpleFSIndexInput, this method returns
 ///  true if the underlying file descriptor is valid, and false otherwise.
 ///  this can be used to determine if the OS file has been closed.
 ///  The descriptor becomes invalid when the non-clone instance of the
 ///  SimpleFSIndexInput that owns this descriptor is closed. However, the
 ///  descriptor may possibly become invalid in other ways as well.
 /// </summary>
 public static bool IsSimpleFSIndexInputOpen(IndexInput @is)
 {
     if (IsSimpleFSIndexInput(@is))
     {
         SimpleFSIndexInput fis = (SimpleFSIndexInput)@is;
         return fis.FDValid;
     }
     else
     {
         return false;
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:20,代码来源:TestHelper.cs


示例10: CompressingTermVectorsReader

 // used by clone
 private CompressingTermVectorsReader(CompressingTermVectorsReader reader)
 {
     this.fieldInfos = reader.fieldInfos;
     this.vectorsStream = (IndexInput)reader.vectorsStream.Clone();
     this.indexReader = (CompressingStoredFieldsIndexReader)reader.indexReader.Clone();
     this.packedIntsVersion = reader.packedIntsVersion;
     this.compressionMode = reader.compressionMode;
     this.decompressor = (Decompressor)reader.decompressor.Clone();
     this.chunkSize = reader.chunkSize;
     this.numDocs = reader.numDocs;
     this.reader = new BlockPackedReaderIterator(vectorsStream, packedIntsVersion, CompressingTermVectorsWriter.BLOCK_SIZE, 0);
     this.version = reader.version;
     this.closed = false;
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:15,代码来源:CompressingTermVectorsReader.cs


示例11: CopyBytes

 /// <summary>Copy numBytes bytes from input to ourself. </summary>
 public virtual void CopyBytes(IndexInput input, long numBytes)
 {
     long left = numBytes;
     if (copyBuffer == null)
         copyBuffer = new byte[COPY_BUFFER_SIZE];
     while (left > 0)
     {
         int toCopy;
         if (left > COPY_BUFFER_SIZE)
             toCopy = COPY_BUFFER_SIZE;
         else
             toCopy = (int) left;
         input.ReadBytes(copyBuffer, 0, toCopy);
         WriteBytes(copyBuffer, 0, toCopy);
         left -= toCopy;
     }
 }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:18,代码来源:IndexOutput.cs


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


示例13: CopyBytes

 /// <summary>Copy numBytes bytes from input to ourself. </summary>
 public virtual void CopyBytes(IndexInput input, long numBytes)
 {
     System.Diagnostics.Debug.Assert(numBytes >= 0, "numBytes=" + numBytes);
     long left = numBytes;
     if (copyBuffer == null)
         copyBuffer = new byte[COPY_BUFFER_SIZE];
     while (left > 0)
     {
         int toCopy;
         if (left > COPY_BUFFER_SIZE)
             toCopy = COPY_BUFFER_SIZE;
         else
             toCopy = (int) left;
         input.ReadBytes(copyBuffer, 0, toCopy);
         WriteBytes(copyBuffer, 0, toCopy);
         left -= toCopy;
     }
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:19,代码来源:IndexOutput.cs


示例14: SlowOpeningMockIndexInputWrapper

 public SlowOpeningMockIndexInputWrapper(MockDirectoryWrapper dir, string name, IndexInput @delegate)
     : base(dir, name, @delegate)
 {
     try
     {
         Thread.Sleep(50);
     }
     catch (ThreadInterruptedException ie)
     {
         try
         {
             base.Dispose();
         } // we didnt open successfully
         catch (Exception)
         {
         }
         throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
     }
 }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:19,代码来源:SlowOpeningMockIndexInputWrapper.cs


示例15: Init

        public override void Init(IndexInput termsIn)
        {
            version = CodecUtil.CheckHeader(termsIn, PulsingPostingsWriter.CODEC,
                PulsingPostingsWriter.VERSION_START,
                PulsingPostingsWriter.VERSION_CURRENT);

            maxPositions = termsIn.ReadVInt();
            _wrappedPostingsReader.Init(termsIn);

            if (_wrappedPostingsReader is PulsingPostingsReader || version < PulsingPostingsWriter.VERSION_META_ARRAY)
            {
                fields = null;
            }
            else
            {
                fields = new SortedDictionary<int, int>();
                String summaryFileName = IndexFileNames.SegmentFileName(segmentState.SegmentInfo.Name,
                    segmentState.SegmentSuffix, PulsingPostingsWriter.SUMMARY_EXTENSION);
                IndexInput input = null;

                try
                {
                    input =
                        segmentState.Directory.OpenInput(summaryFileName, segmentState.Context);
                    CodecUtil.CheckHeader(input,
                        PulsingPostingsWriter.CODEC,
                        version,
                        PulsingPostingsWriter.VERSION_CURRENT);

                    int numField = input.ReadVInt();
                    for (int i = 0; i < numField; i++)
                    {
                        int fieldNum = input.ReadVInt();
                        int longsSize = input.ReadVInt();
                        fields.Add(fieldNum, longsSize);
                    }
                }
                finally
                {
                    IOUtils.CloseWhileHandlingException(input);
                }
            }
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:43,代码来源:PulsingPostingsReader.cs


示例16: MonotonicBlockPackedReader

 /// <summary>
 /// Sole constructor. </summary>
 public MonotonicBlockPackedReader(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);
     MinValues = new long[numBlocks];
     Averages = new float[numBlocks];
     SubReaders = new PackedInts.Reader[numBlocks];
     for (int i = 0; i < numBlocks; ++i)
     {
         MinValues[i] = @in.ReadVLong();
         Averages[i] = Number.IntBitsToFloat(@in.ReadInt());
         int bitsPerValue = @in.ReadVInt();
         if (bitsPerValue > 64)
         {
             throw new Exception("Corrupted");
         }
         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);
             }
         }
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:40,代码来源:MonotonicBlockPackedReader.cs


示例17: Lucene41PostingsReader

        // public static boolean DEBUG = false;
        /// <summary>
        /// Sole constructor. </summary>
        public Lucene41PostingsReader(Directory dir, FieldInfos fieldInfos, SegmentInfo segmentInfo, IOContext ioContext, string segmentSuffix)
        {
            bool success = false;
            IndexInput docIn = null;
            IndexInput posIn = null;
            IndexInput payIn = null;
            try
            {
                docIn = dir.OpenInput(IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, Lucene41PostingsFormat.DOC_EXTENSION), ioContext);
                Version = CodecUtil.CheckHeader(docIn, Lucene41PostingsWriter.DOC_CODEC, Lucene41PostingsWriter.VERSION_START, Lucene41PostingsWriter.VERSION_CURRENT);
                forUtil = new ForUtil(docIn);

                if (fieldInfos.HasProx())
                {
                    posIn = dir.OpenInput(IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, Lucene41PostingsFormat.POS_EXTENSION), ioContext);
                    CodecUtil.CheckHeader(posIn, Lucene41PostingsWriter.POS_CODEC, Version, Version);

                    if (fieldInfos.HasPayloads() || fieldInfos.HasOffsets())
                    {
                        payIn = dir.OpenInput(IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, Lucene41PostingsFormat.PAY_EXTENSION), ioContext);
                        CodecUtil.CheckHeader(payIn, Lucene41PostingsWriter.PAY_CODEC, Version, Version);
                    }
                }

                this.DocIn = docIn;
                this.PosIn = posIn;
                this.PayIn = payIn;
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(docIn, posIn, payIn);
                }
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:40,代码来源:Lucene41PostingsReader.cs


示例18: AssertSameStreams

        private void AssertSameStreams(string msg, IndexInput expected, IndexInput test)
        {
            Assert.IsNotNull(expected, msg + " null expected");
            Assert.IsNotNull(test, msg + " null test");
            Assert.AreEqual(expected.Length(), test.Length(), msg + " length");
            Assert.AreEqual(expected.FilePointer, test.FilePointer, msg + " position");

            var expectedBuffer = new byte[512];
            var testBuffer = new byte[expectedBuffer.Length];

            long remainder = expected.Length() - expected.FilePointer;
            while (remainder > 0)
            {
                int readLen = (int)Math.Min(remainder, expectedBuffer.Length);
                expected.ReadBytes(expectedBuffer, 0, readLen);
                test.ReadBytes(testBuffer, 0, readLen);
                AssertEqualArrays(msg + ", remainder " + remainder, expectedBuffer, testBuffer, 0, readLen);
                remainder -= readLen;
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:20,代码来源:TestCompoundFile.cs


示例19: AssertSameSeekBehavior

        private void AssertSameSeekBehavior(string msg, IndexInput expected, IndexInput actual)
        {
            // seek to 0
            long point = 0;
            AssertSameStreams(msg + ", seek(0)", expected, actual, point);

            // seek to middle
            point = expected.Length() / 2l;
            AssertSameStreams(msg + ", seek(mid)", expected, actual, point);

            // seek to end - 2
            point = expected.Length() - 2;
            AssertSameStreams(msg + ", seek(end-2)", expected, actual, point);

            // seek to end - 1
            point = expected.Length() - 1;
            AssertSameStreams(msg + ", seek(end-1)", expected, actual, point);

            // seek to the end
            point = expected.Length();
            AssertSameStreams(msg + ", seek(end)", expected, actual, point);

            // seek past end
            point = expected.Length() + 1;
            AssertSameStreams(msg + ", seek(end+1)", expected, actual, point);
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:26,代码来源:TestCompoundFile.cs


示例20: TestManySubFiles

        public virtual void TestManySubFiles()
        {
            Directory d = NewFSDirectory(CreateTempDir("CFSManySubFiles"));
            int FILE_COUNT = AtLeast(500);

            for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
            {
                IndexOutput @out = d.CreateOutput("file." + fileIdx, NewIOContext(Random()));
                @out.WriteByte((byte)(sbyte)fileIdx);
                @out.Dispose();
            }

            CompoundFileDirectory cfd = new CompoundFileDirectory(d, "c.cfs", NewIOContext(Random()), true);
            for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
            {
                string fileName = "file." + fileIdx;
                d.Copy(cfd, fileName, fileName, NewIOContext(Random()));
            }
            cfd.Dispose();

            IndexInput[] ins = new IndexInput[FILE_COUNT];
            CompoundFileDirectory cfr = new CompoundFileDirectory(d, "c.cfs", NewIOContext(Random()), false);
            for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
            {
                ins[fileIdx] = cfr.OpenInput("file." + fileIdx, NewIOContext(Random()));
            }

            for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
            {
                Assert.AreEqual((byte)fileIdx, ins[fileIdx].ReadByte());
            }

            for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
            {
                ins[fileIdx].Dispose();
            }
            cfr.Dispose();
            d.Dispose();
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:39,代码来源:TestCompoundFile.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Store.LockFactory类代码示例发布时间:2022-05-26
下一篇:
C# Store.Directory类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap