Lucene.Net.Store.DataInput.ReadVLong C# (CSharp) Метод

ReadVLong() публичный Метод

Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

The format is described further in DataOutput#writeVInt(int).

public ReadVLong ( ) : long
Результат long
        public virtual long ReadVLong()
        {
            // .NET Port: going back to old style code
            /*byte b = ReadByte();
            long i = b & 0x7F;
            for (int shift = 7; (b & 0x80) != 0; shift += 7)
            {
                b = ReadByte();
                i |= (b & 0x7FL) << shift;
            }
            return i;*/

            byte b = ReadByte();
            if ((sbyte)b >= 0)
            {
                return b;
            }
            long i = b & 0x7FL;
            b = ReadByte();
            i |= (b & 0x7FL) << 7;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 14;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 21;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 28;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 35;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 42;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 49;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            b = ReadByte();
            i |= (b & 0x7FL) << 56;
            if ((sbyte)b >= 0)
            {
                return i;
            }
            throw new System.IO.IOException("Invalid vLong detected (negative values disallowed)");
        }

Usage Example

 public override void Read(DataInput indexIn, bool absolute)
 {
     if (absolute)
     {
         fp = indexIn.ReadVLong();
     }
     else
     {
         fp += indexIn.ReadVLong();
     }
 }
All Usage Examples Of Lucene.Net.Store.DataInput::ReadVLong