com.linecorp.armeria.common.MediaType.withCharset()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中com.linecorp.armeria.common.MediaType.withCharset()方法的一些代码示例,展示了MediaType.withCharset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaType.withCharset()方法的具体详情如下:
包路径:com.linecorp.armeria.common.MediaType
类名称:MediaType
方法名:withCharset

MediaType.withCharset介绍

[英]Returns a new instance with the same type and subtype as this instance, with the charset parameter set to the Charset#name of the given charset. Only one charset parameter will be present on the new instance regardless of the number set on this one.

If a charset must be specified that is not supported on this JVM (and thus is not representable as a Charset instance, use #withParameter.
[中]

代码示例

代码示例来源:origin: line/armeria

@Override
protected Set<Entry> entries() {
  return ImmutableSet.of(
      new Entry("tbinary",
           create("x-thrift", "TBINARY"),
           create("vnd.apache.thrift.binary")),
      new Entry("tcompact",
           create("x-thrift", "TCOMPACT"),
           create("vnd.apache.thrift.compact")),
      new Entry("tjson",
           create("x-thrift", "TJSON"),
           create("x-thrift", "TJSON").withCharset(UTF_8),
           create("vnd.apache.thrift.json"),
           create("vnd.apache.thrift.json").withCharset(UTF_8)),
      new Entry("ttext",
           create("x-thrift", "TTEXT"),
           create("x-thrift", "TTEXT").withCharset(UTF_8),
           create("vnd.apache.thrift.text"),
           create("vnd.apache.thrift.text").withCharset(UTF_8)));
}

代码示例来源:origin: com.linecorp.armeria/armeria-thrift0.9

@Override
protected Set<Entry> entries() {
  return ImmutableSet.of(
      new Entry("tbinary",
           create("x-thrift", "TBINARY"),
           create("vnd.apache.thrift.binary")),
      new Entry("tcompact",
           create("x-thrift", "TCOMPACT"),
           create("vnd.apache.thrift.compact")),
      new Entry("tjson",
           create("x-thrift", "TJSON"),
           create("x-thrift", "TJSON").withCharset(UTF_8),
           create("vnd.apache.thrift.json"),
           create("vnd.apache.thrift.json").withCharset(UTF_8)),
      new Entry("ttext",
           create("x-thrift", "TTEXT"),
           create("x-thrift", "TTEXT").withCharset(UTF_8),
           create("vnd.apache.thrift.text"),
           create("vnd.apache.thrift.text").withCharset(UTF_8)));
}

代码示例来源:origin: com.linecorp.armeria/armeria-thrift

@Override
protected Set<Entry> entries() {
  return ImmutableSet.of(
      new Entry("tbinary",
           create("x-thrift", "TBINARY"),
           create("vnd.apache.thrift.binary")),
      new Entry("tcompact",
           create("x-thrift", "TCOMPACT"),
           create("vnd.apache.thrift.compact")),
      new Entry("tjson",
           create("x-thrift", "TJSON"),
           create("x-thrift", "TJSON").withCharset(UTF_8),
           create("vnd.apache.thrift.json"),
           create("vnd.apache.thrift.json").withCharset(UTF_8)),
      new Entry("ttext",
           create("x-thrift", "TTEXT"),
           create("x-thrift", "TTEXT").withCharset(UTF_8),
           create("vnd.apache.thrift.text"),
           create("vnd.apache.thrift.text").withCharset(UTF_8)));
}

代码示例来源:origin: com.linecorp.armeria/armeria-thrift0.9-shaded

@Override
protected Set<Entry> entries() {
  return ImmutableSet.of(
      new Entry("tbinary",
           create("x-thrift", "TBINARY"),
           create("vnd.apache.thrift.binary")),
      new Entry("tcompact",
           create("x-thrift", "TCOMPACT"),
           create("vnd.apache.thrift.compact")),
      new Entry("tjson",
           create("x-thrift", "TJSON"),
           create("x-thrift", "TJSON").withCharset(UTF_8),
           create("vnd.apache.thrift.json"),
           create("vnd.apache.thrift.json").withCharset(UTF_8)),
      new Entry("ttext",
           create("x-thrift", "TTEXT"),
           create("x-thrift", "TTEXT").withCharset(UTF_8),
           create("vnd.apache.thrift.text"),
           create("vnd.apache.thrift.text").withCharset(UTF_8)));
}

相关文章