int pos = mimeType.indexOf(';');
int state = 0; int lastState = 0; int tok;  try { String paramName = null; StreamTokenizer in = new StreamTokenizer(new StringReader(mimeType)); in.resetSyntax();    in.whitespaceChars(0x00, 0x20); in.whitespaceChars(0x7F, 0x7F); in.wordChars('A', 'Z'); in.wordChars('a', 'z'); in.wordChars('0', '9'); in.wordChars(0xA0, 0xFF); in.wordChars(0x21, 0x21); in.wordChars(0x23, 0x27); in.wordChars(0x2A, 0x2B); in.wordChars(0x2D, 0x2E); in.wordChars(0x5E, 0x60); in.wordChars(0x7B, 0x7E); in.quoteChar('"');
  private void parseMimeType(String mimeType)  {    // FIXME: This method is know to be not completely correct, but it works for now.        int pos = mimeType.indexOf(';');    if (pos != -1)      {	String tmp = mimeType.substring(pos + 2);	mimeType = mimeType.substring(0, pos);	pos = tmp.indexOf('=');	params.put(tmp.substring(0, pos), tmp.substring(pos + 1));      }    pos = mimeType.indexOf('/');    if (pos == -1)      throw new IllegalArgumentException();    mediaType = mimeType.substring(0, pos);    mediaSubtype = mimeType.substring(pos + 1);  }