public static function readUnsignedVarInt($data)
    {
        $fd = fopen('data://text/plain,' . urlencode($data), 'rb');

        $original = '';
        $result = $shift = 0;
        do {
            $readValue = self::read($fd, 1);
            if(false === $readValue || $readValue === null) {
                return false;
            }
            $original .= $readValue;
            $byte = ord($readValue);
            $result |= ($byte & 0x7f) << $shift++ * 7;

            if($shift > 5) {
                throw new InvalidDataException('VarInt greater than allowed range');
            }
        } while ($byte > 0x7f);

        return new VarInt($result, $original, $shift);
    }