简体   繁体   English

Android中的改造响应

[英]Retrofit Response in Android

What is the difference betweeen string() and toString() for Retrofit Response ? 改造响应string()toString()之间有什么区别?

Can any tell the difference in details. 谁能说出细节上的区别。

 response.body().string();

 response.body().toString();

response.body().string(); returns response body converted to String. 返回转换为String的响应主体。 JSON, for example. 以JSON为例。

response.body().toString(); returns string look of ResponseBody object. 返回ResponseBody对象的字符串外观。 It hash, class ... 哈希,类...

response.body().toString(); - Convert object responseBody(body()) to string -将对象responseBody(body())转换为字符串

return getClass().getName() + "@" + Integer.toHexString(hashCode());

response.body().string(); - Convert response from server to string; -将响应从服务器转换为字符串;

.toString(): This returns your object in string format. .toString():这将以字符串格式返回对象。

.string(): This returns your response. .string():这将返回您的响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM