132 lines
4.4 KiB
Java
132 lines
4.4 KiB
Java
package retrofit2;
|
|
|
|
import java.io.IOException;
|
|
import java.lang.annotation.Annotation;
|
|
import java.lang.reflect.Type;
|
|
import o.C14866gag;
|
|
import okhttp3.RequestBody;
|
|
import okhttp3.ResponseBody;
|
|
import retrofit2.Converter;
|
|
import retrofit2.http.Streaming;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public final class BuiltInConverters extends Converter.Factory {
|
|
private boolean checkForKotlinUnit = true;
|
|
|
|
@Override // retrofit2.Converter.Factory
|
|
public final Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotationArr, Retrofit retrofit) {
|
|
if (type == ResponseBody.class) {
|
|
if (Utils.isAnnotationPresent(annotationArr, Streaming.class)) {
|
|
return StreamingResponseBodyConverter.INSTANCE;
|
|
}
|
|
return BufferingResponseBodyConverter.INSTANCE;
|
|
}
|
|
if (type == Void.class) {
|
|
return VoidResponseBodyConverter.INSTANCE;
|
|
}
|
|
if (!this.checkForKotlinUnit || type != C14866gag.class) {
|
|
return null;
|
|
}
|
|
try {
|
|
return UnitResponseBodyConverter.INSTANCE;
|
|
} catch (NoClassDefFoundError unused) {
|
|
this.checkForKotlinUnit = false;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Override // retrofit2.Converter.Factory
|
|
public final Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] annotationArr, Annotation[] annotationArr2, Retrofit retrofit) {
|
|
if (RequestBody.class.isAssignableFrom(Utils.getRawType(type))) {
|
|
return RequestBodyConverter.INSTANCE;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class VoidResponseBodyConverter implements Converter<ResponseBody, Void> {
|
|
static final VoidResponseBodyConverter INSTANCE = new VoidResponseBodyConverter();
|
|
|
|
VoidResponseBodyConverter() {
|
|
}
|
|
|
|
@Override // retrofit2.Converter
|
|
public final Void convert(ResponseBody responseBody) {
|
|
responseBody.close();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class UnitResponseBodyConverter implements Converter<ResponseBody, C14866gag> {
|
|
static final UnitResponseBodyConverter INSTANCE = new UnitResponseBodyConverter();
|
|
|
|
UnitResponseBodyConverter() {
|
|
}
|
|
|
|
@Override // retrofit2.Converter
|
|
public final C14866gag convert(ResponseBody responseBody) {
|
|
responseBody.close();
|
|
return C14866gag.c;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class RequestBodyConverter implements Converter<RequestBody, RequestBody> {
|
|
static final RequestBodyConverter INSTANCE = new RequestBodyConverter();
|
|
|
|
@Override // retrofit2.Converter
|
|
public final RequestBody convert(RequestBody requestBody) {
|
|
return requestBody;
|
|
}
|
|
|
|
RequestBodyConverter() {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class StreamingResponseBodyConverter implements Converter<ResponseBody, ResponseBody> {
|
|
static final StreamingResponseBodyConverter INSTANCE = new StreamingResponseBodyConverter();
|
|
|
|
@Override // retrofit2.Converter
|
|
public final ResponseBody convert(ResponseBody responseBody) {
|
|
return responseBody;
|
|
}
|
|
|
|
StreamingResponseBodyConverter() {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class BufferingResponseBodyConverter implements Converter<ResponseBody, ResponseBody> {
|
|
static final BufferingResponseBodyConverter INSTANCE = new BufferingResponseBodyConverter();
|
|
|
|
BufferingResponseBodyConverter() {
|
|
}
|
|
|
|
@Override // retrofit2.Converter
|
|
public final ResponseBody convert(ResponseBody responseBody) throws IOException {
|
|
try {
|
|
return Utils.buffer(responseBody);
|
|
} finally {
|
|
responseBody.close();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static final class ToStringConverter implements Converter<Object, String> {
|
|
static final ToStringConverter INSTANCE = new ToStringConverter();
|
|
|
|
ToStringConverter() {
|
|
}
|
|
|
|
@Override // retrofit2.Converter
|
|
public final String convert(Object obj) {
|
|
return obj.toString();
|
|
}
|
|
}
|
|
}
|