Lucene.Net.Index.BinaryDocValuesWriter.GetBytesIterator C# (CSharp) Метод

GetBytesIterator() приватный Метод

private GetBytesIterator ( int maxDocParam ) : IEnumerable
maxDocParam int
Результат IEnumerable
        private IEnumerable<BytesRef> GetBytesIterator(int maxDocParam)
        {
            // Use yield return instead of ucsom IEnumerable

            BytesRef value = new BytesRef();
            AppendingDeltaPackedLongBuffer.Iterator lengthsIterator = (AppendingDeltaPackedLongBuffer.Iterator)Lengths.GetIterator();
            int size = (int)Lengths.Size();
            DataInput bytesIterator = Bytes.DataInput;
            int maxDoc = maxDocParam;
            int upto = 0;
            long byteOffset = 0L;

            while (upto < maxDoc)
            {
                if (upto < size)
                {
                    int length = (int)lengthsIterator.Next();
                    value.Grow(length);
                    value.Length = length;
                    //LUCENE TODO: This modification is slightly fishy, 4x port uses ByteBlockPool
                    bytesIterator.ReadBytes(/*byteOffset,*/ value.Bytes, value.Offset, value.Length);
                    byteOffset += length;
                }
                else
                {
                    // This is to handle last N documents not having
                    // this DV field in the end of the segment:
                    value.Length = 0;
                }

                upto++;
                yield return value;
            }
        }