public static int readVarInt(InputStream input) throws IOException {
        int value = 0;

        for (int i = 0; i < 10; i++) {
            byte b = (byte) readByteOrEOF(input);
            value |= (b & 0x7F) << (7 * i);

            if ((b & 0x80) == 0) {
                break;
            }
        }

        return value;
    }
Reads a varint from input stream.

@return varint
@throws IOException when failed to read value from input stream or reached
                    end of the stream
client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReader.java