private static Map<String, String> parseParameters(String string) {
        if (string.isEmpty()) {
            return Collections.emptyMap();
        }

        // Extracts k1=v1, k2=v2 from mime/type; k1=v1; k2=v2
        // Note - this logic isn't fully RFC2045 compliant yet, as it
        //  doesn't fully handle quoted keys or values (eg containing ; or =)
        Map<String, String> parameters = new HashMap<>();
        while (string.length() > 0) {
            String key = string;
            String value = "";

            int semicolon = string.indexOf(';');
            if (semicolon != -1) {
                key = string.substring(0, semicolon);
                string = string.substring(semicolon + 1);
            } else {
                string = "";
            }

            int equals = key.indexOf('=');
            if (equals != -1) {
                value = key.substring(equals + 1);
                key = key.substring(0, equals);
            }

            key = key.trim();
            if (key.length() > 0) {
                parameters.put(key, unquote(value.trim()));
            }
        }
        return parameters;
    }
Parses the given string to a media type. The string is expected
to be of the form "type/subtype(; parameter=...)*" as defined in
RFC 2045, though we also handle "charset=xxx; type/subtype" for
broken web servers.

@param string media type string to be parsed
@return parsed media type, or <code>null</code> if parsing fails
tika-core/src/main/java/org/apache/tika/mime/MediaType.java