Closed iSally closed 4 years ago
你自己创建转换器代码咋写的?
public class FastJsonResponseBodyConverter implements Converter<ResponseBody, String> {
FastJsonResponseBodyConverter() {
}
@Override
public String convert(@NonNull ResponseBody value) throws IOException {
String string = value.string().replace(" ", "");
String response = string.substring(1, string.length() - 1).replace("\\\"", "\"");
response = response.replace("\\\\","\\");
boolean isHead = true;
if (BuildConfig.DEBUG) {
if (response.length() > 3500) {
for (int i = 0; i < response.length(); i += 3500) {
if (i + 3500 < response.length()) {
if (isHead) {
Log.i("FastJsonResponseBody", "<---part-" + (i / 3500 + 1) + "--->" + response.substring(i, i + 3500));
isHead = false;
} else {
Log.i("FastJsonResponseBody", "<---part-" + (i / 3500 + 1) + "--->" + response.substring(i, i + 3500));
}
} else {
Log.i("FastJsonResponseBody", "<---part-" + (i / 3500 + 1) + "--->" + response.substring(i, response.length()));
}
}
} else {
Log.i("FastJsonResponseBody", "<---data--->" + response);
}
}
return response;
}
}
这个是我自己写的转换器,但是我还没add,我也纳闷为啥为啥无法创建转换器
我添加了自己的转换器,他也报错,
Unable to create converter for class
可是我确实看到作者在FastRetrofit中添加了转换器
搞了一下午,我头都大了