feign.Util.toString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(207)

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

Util.toString介绍

[英]Adapted from com.google.common.io.CharStreams.toString().
[中]改编自com。谷歌。常见的伊奥。CharStreams。toString()。

代码示例

代码示例来源:origin: com.netflix.feign/feign-core

  1. @Override
  2. public Object decode(Response response, Type type) throws IOException {
  3. Response.Body body = response.body();
  4. if (body == null) {
  5. return null;
  6. }
  7. if (String.class.equals(type)) {
  8. return Util.toString(body.asReader());
  9. }
  10. throw new DecodeException(format("%s is not a type supported by this decoder.", type));
  11. }
  12. }

代码示例来源:origin: com.netflix.feign/feign-core

  1. public static FeignException errorStatus(String methodKey, Response response) {
  2. String message = format("status %s reading %s", response.status(), methodKey);
  3. try {
  4. if (response.body() != null) {
  5. String body = Util.toString(response.body().asReader());
  6. message += "; content:\n" + body;
  7. }
  8. } catch (IOException ignored) { // NOPMD
  9. }
  10. return new FeignException(response.status(), message);
  11. }

代码示例来源:origin: Netflix/metacat

  1. String message = "";
  2. if (response.body() != null) {
  3. message = Util.toString(response.body().asReader());
  4. try {
  5. final ObjectNode body = metacatJson.parseJsonObject(message);

相关文章