what-the-bank/sources/retrofit2/converter/simplexml/SimpleXmlRequestBodyConvert...

45 lines
1.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package retrofit2.converter.simplexml;
import java.io.IOException;
import java.io.OutputStreamWriter;
import o.C15111ghZ;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.simpleframework.xml.Serializer;
import retrofit2.Converter;
/* loaded from: classes.dex */
final class SimpleXmlRequestBodyConverter<T> implements Converter<T, RequestBody> {
private static final String CHARSET = "UTF-8";
private static final MediaType MEDIA_TYPE = MediaType.get("application/xml; charset=UTF-8");
private final Serializer serializer;
/* JADX WARN: Multi-variable type inference failed */
@Override // retrofit2.Converter
public final /* bridge */ /* synthetic */ RequestBody convert(Object obj) throws IOException {
return convert((SimpleXmlRequestBodyConverter<T>) obj);
}
/* JADX INFO: Access modifiers changed from: package-private */
public SimpleXmlRequestBodyConverter(Serializer serializer) {
this.serializer = serializer;
}
@Override // retrofit2.Converter
public final RequestBody convert(T t) throws IOException {
C15111ghZ c15111ghZ = new C15111ghZ();
try {
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new C15111ghZ.Sts(c15111ghZ), CHARSET);
this.serializer.write(t, outputStreamWriter);
outputStreamWriter.flush();
return RequestBody.create(MEDIA_TYPE, c15111ghZ.c(c15111ghZ.c));
} catch (IOException e) {
throw e;
} catch (RuntimeException e2) {
throw e2;
} catch (Exception e3) {
throw new RuntimeException(e3);
}
}
}