parameters.clear();
final int mimeDelim = contentType.indexOf(';");
if (mimeDelim == -1) { // If the contentType doesn't have params
mimeType = contentType.trim().toLowerCase();
return;
} else {
mimeType = contentType.substring(0, mimeDelim).trim().toLowerCase();
}
int delim = mimeDelim + 1;
// Scan ContentType string's params, decode them
while(delim < contentType.length()) {
int nextDelim = contentType.indexOf(';", delim);
if (nextDelim == -1) nextDelim = contentType.length();
int eqDelim = contentType.indexOf('=", delim);
if (eqDelim == -1) eqDelim = nextDelim;
final String key = contentType.substring(delim, eqDelim).trim();
final String value = contentType.substring(eqDelim + 1, nextDelim).trim();
parameters.put(key, value);
delim = nextDelim + 1;
}