The format is described further in DataOutput#writeVInt(int).
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)"); }
public override void Read(DataInput indexIn, bool absolute) { if (absolute) { fp = indexIn.ReadVLong(); } else { fp += indexIn.ReadVLong(); } }