public static boolean isValid(String name) {
        if (name == null) {
            throw new IllegalArgumentException("Name is missing");
        }

        boolean slash = false;
        for (int i = 0; i < name.length(); i++) {
            char ch = name.charAt(i);
            if (ch <= ' ' || ch >= 127 || ch == '(' || ch == ')' || ch == '<' || ch == '>' ||
                    ch == '@' || ch == ',' || ch == ';' || ch == ':' || ch == '\\' || ch == '"' ||
                    ch == '[' || ch == ']' || ch == '?' || ch == '=') {
                return false;
            } else if (ch == '/') {
                if (slash || i == 0 || i + 1 == name.length()) {
                    return false;
                }
                slash = true;
            }
        }
        return slash;
    }
Checks that the given string is a valid Internet media type name
based on rules from RFC 2054 section 5.3. For validation purposes the
rules can be simplified to the following:
<pre>
name := token "/" token
token := 1*&lt;any (US-ASCII) CHAR except SPACE, CTLs, or tspecials&gt;
tspecials :=  "(" / ")" / "&lt;" / "&gt;" / "@" / "," / ";" / ":" /
              "\" / <"> / "/" / "[" / "]" / "?" / "="
</pre>

@param name name string
@return <code>true</code> if the string is a valid media type name,
<code>false</code> otherwise
tika-core/src/main/java/org/apache/tika/mime/MimeType.java