code: public void updateMimeType() 
      {
          _mimeType=null;
          _characterEncoding=null;
              
          String contentType= _header.get(HttpFields.__ContentType);
          if (contentType!=null)
          {
              // Look for encoding in contentType
              int i0=contentType.indexOf(';');
              
              if (i0>0)
              {
                  // Strip params off mimetype
                  _mimeType=contentType.substring(0,i0).trim();
  
                  // Look for charset
                  int i1=contentType.indexOf("charset=",i0);
                  if (i1>=0)
                  {
                      i1+=8;
                      int i2 = contentType.indexOf(' ',i1);
                      _characterEncoding = (0<i2)
                          ? contentType.substring(i1,i2)
                          : contentType.substring(i1);
                      _characterEncoding = QuotedStringTokenizer.unquote(_characterEncoding);
                  }
              }
              else 
              {
                  _mimeType=contentType;
              }
          }
      }
docs: /* ------------------------------------------------------------