本文整理汇总了C#中Lucene.Net.Store.IndexInput类的典型用法代码示例。如果您正苦于以下问题:C# IndexInput类的具体用法?C# IndexInput怎么用?C# IndexInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexInput类属于Lucene.Net.Store命名空间,在下文中一共展示了IndexInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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 + ")");
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
}