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


C# IndexInput.ReadBytes方法代码示例

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


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

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

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

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

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

示例5: CheckReadBytes

		private void  CheckReadBytes(IndexInput input, int size, int pos)
		{
			// Just to see that "offset" is treated properly in readBytes(), we
			// add an arbitrary offset at the beginning of the array
			int offset = size % 10; // arbitrary
			buffer = ArrayUtil.Grow(buffer, offset + size);
			Assert.AreEqual(pos, input.FilePointer);
			long left = TEST_FILE_LENGTH - input.FilePointer;
			if (left <= 0)
			{
				return ;
			}
			else if (left < size)
			{
				size = (int) left;
			}
			input.ReadBytes(buffer, offset, size);
			Assert.AreEqual(pos + size, input.FilePointer);
			for (int i = 0; i < size; i++)
			{
				Assert.AreEqual(Byten(pos + i), buffer[offset + i], "pos=" + i + " filepos=" + (pos + i));
			}
		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:23,代码来源:TestBufferedIndexInput.cs


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