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


C# Lucene.Net.Store.Directory.OpenChecksumInput方法代码示例

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


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

示例1: Read

        public override SegmentInfo Read(Directory dir, string segment, IOContext context)
        {
            string fileName = IndexFileNames.SegmentFileName(segment, "", Lucene46SegmentInfoFormat.SI_EXTENSION);
            ChecksumIndexInput input = dir.OpenChecksumInput(fileName, context);
            bool success = false;
            try
            {
                int codecVersion = CodecUtil.CheckHeader(input, Lucene46SegmentInfoFormat.CODEC_NAME, Lucene46SegmentInfoFormat.VERSION_START, Lucene46SegmentInfoFormat.VERSION_CURRENT);
                string version = input.ReadString();
                int docCount = input.ReadInt();
                if (docCount < 0)
                {
                    throw new CorruptIndexException("invalid docCount: " + docCount + " (resource=" + input + ")");
                }
                bool isCompoundFile = input.ReadByte() == SegmentInfo.YES;
                IDictionary<string, string> diagnostics = input.ReadStringStringMap();
                ISet<string> files = input.ReadStringSet();

                if (codecVersion >= Lucene46SegmentInfoFormat.VERSION_CHECKSUM)
                {
                    CodecUtil.CheckFooter(input);
                }
                else
                {
                    CodecUtil.CheckEOF(input);
                }

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

                success = true;

                return si;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(input);
                }
                else
                {
                    input.Dispose();
                }
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:46,代码来源:Lucene46SegmentInfoReader.cs

示例2: BitVector

        /// <summary>
        /// Constructs a bit vector from the file <code>name</code> in Directory
        ///  <code>d</code>, as written by the <seealso cref="#write"/> method.
        /// </summary>
        public BitVector(Directory d, string name, IOContext context)
        {
            ChecksumIndexInput input = d.OpenChecksumInput(name, context);

            try
            {
                int firstInt = input.ReadInt();

                if (firstInt == -2)
                {
                    // New format, with full header & version:
                    Version_Renamed = CodecUtil.CheckHeader(input, CODEC, VERSION_START, VERSION_CURRENT);
                    Size_Renamed = input.ReadInt();
                }
                else
                {
                    Version_Renamed = VERSION_PRE;
                    Size_Renamed = firstInt;
                }
                if (Size_Renamed == -1)
                {
                    if (Version_Renamed >= VERSION_DGAPS_CLEARED)
                    {
                        ReadClearedDgaps(input);
                    }
                    else
                    {
                        ReadSetDgaps(input);
                    }
                }
                else
                {
                    ReadBits(input);
                }

                if (Version_Renamed < VERSION_DGAPS_CLEARED)
                {
                    InvertAll();
                }

                if (Version_Renamed >= VERSION_CHECKSUM)
                {
                    CodecUtil.CheckFooter(input);
                }
                else
                {
                    CodecUtil.CheckEOF(input);
                }
                Debug.Assert(VerifyCount());
            }
            finally
            {
                input.Dispose();
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:59,代码来源:BitVector.cs


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