本文整理汇总了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();
}
}
}
示例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();
}
}