class MediaType {

  public Charset charsetOrDefault(Charset defaultCharset) {
    requireNonNull(defaultCharset);
    try {
      return charset().orElse(defaultCharset);
    } catch (UnsupportedCharsetException ignored) {
      return defaultCharset;
    }
  }

  private  MediaType(String type, String subtype);
  private  MediaType(String type, String subtype, Map<String, String> parameters);

}