code: private static String extractContentType(String line) throws IOException {
      // Convert the line to a lowercase string
      line = line.toLowerCase();
  
      // Get the content type, if any
      // Note that Opera at least puts extra info after the type, so handle
      // that.  For example:  Content-Type: text/plain; name="foo"
      // Thanks to Leon Poyyayil, leon.poyyayil@trivadis.com, for noticing this.
      int end = line.indexOf(";");
      if (end == -1) {
        end = line.length();
      }
  
      return line.substring(13, end).trim();  // "content-type:" is 13
    }
docs: Extracts and returns the content type from a line, or null if the
  line was empty.
  
  @return content type, or null if line was empty.
  @exception  IOException if the line is malformatted.