本文整理了Java中feign.Util.toString()
方法的一些代码示例,展示了Util.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.toString()
方法的具体详情如下:
包路径:feign.Util
类名称:Util
方法名:toString
[英]Adapted from com.google.common.io.CharStreams.toString().
[中]改编自com。谷歌。常见的伊奥。CharStreams。toString()。
代码示例来源:origin: com.netflix.feign/feign-core
@Override
public Object decode(Response response, Type type) throws IOException {
Response.Body body = response.body();
if (body == null) {
return null;
}
if (String.class.equals(type)) {
return Util.toString(body.asReader());
}
throw new DecodeException(format("%s is not a type supported by this decoder.", type));
}
}
代码示例来源:origin: com.netflix.feign/feign-core
public static FeignException errorStatus(String methodKey, Response response) {
String message = format("status %s reading %s", response.status(), methodKey);
try {
if (response.body() != null) {
String body = Util.toString(response.body().asReader());
message += "; content:\n" + body;
}
} catch (IOException ignored) { // NOPMD
}
return new FeignException(response.status(), message);
}
代码示例来源:origin: Netflix/metacat
String message = "";
if (response.body() != null) {
message = Util.toString(response.body().asReader());
try {
final ObjectNode body = metacatJson.parseJsonObject(message);
内容来源于网络,如有侵权,请联系作者删除!