public ClickHouseOutputStream writeUnsignedVarInt(long value) throws IOException {
        // https://github.com/ClickHouse/ClickHouse/blob/abe314feecd1647d7c2b952a25da7abf5c19f352/src/IO/VarInt.h#L187
        int i = 0;
        for (; i < 9; i++) {
            byte b = (byte) (value & 0x7F);

            if (value > 0x7F) {
                b |= 0x80;
            }

            value >>= 7;
            writeByte(b);

            if (value == 0) {
                break;
            }
        }

        return this;
    }
Writes varint into output stream.

@param value varint
@return this output stream
@throws IOException when failed to write value into output stream, not able
                    to sent all bytes, or operate on a closed stream
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseOutputStream.java