code: public static CharSequence getMimeType(CharSequence contentTypeValue) {
          if (contentTypeValue == null) {
              throw new NullPointerException("contentTypeValue");
          }
  
          int indexOfSemicolon = AsciiString.indexOfIgnoreCaseAscii(contentTypeValue, SEMICOLON, 0);
          if (indexOfSemicolon != AsciiString.INDEX_NOT_FOUND) {
              return contentTypeValue.subSequence(0, indexOfSemicolon);
          } else {
              return contentTypeValue.length() > 0 ? contentTypeValue : null;
          }
      }
docs: Fetch MIME type part from Content-Type header value as a char sequence.
  
  @param contentTypeValue Content-Type header value to parse
  @return the MIME type as a {@code CharSequence} from message's Content-Type header
  or {@code null} if content-type header or MIME type part of this header are not presented
  <p/>
  "content-type: text/html; charset=utf-8" - "text/html" will be returned <br/>
  "content-type: text/html" - "text/html" will be returned <br/>
  "content-type: empty header - {@code null} we be returned
  @throws NullPointerException in case if {@code contentTypeValue == null}