public static ContentType parse(
final String s) throws ParseException, UnsupportedCharsetException {
Args.notNull(s, "Content type");
final CharArrayBuffer buf = new CharArrayBuffer(s.length());
buf.append(s);
final ParserCursor cursor = new ParserCursor(0, s.length());
final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
if (elements.length > 0) {
return create(elements[0], true);
} else {
throw new ParseException("Invalid content type: " + s);