package retrofit2.converter.gson; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.Charset; import o.C15111ghZ; import okhttp3.MediaType; import okhttp3.RequestBody; import retrofit2.Converter; /* loaded from: classes.dex */ final class GsonRequestBodyConverter implements Converter { private static final MediaType MEDIA_TYPE = MediaType.get("application/json; charset=UTF-8"); private static final Charset UTF_8 = Charset.forName("UTF-8"); private final TypeAdapter adapter; private final Gson gson; /* JADX WARN: Multi-variable type inference failed */ @Override // retrofit2.Converter public final /* bridge */ /* synthetic */ RequestBody convert(Object obj) throws IOException { return convert((GsonRequestBodyConverter) obj); } /* JADX INFO: Access modifiers changed from: package-private */ public GsonRequestBodyConverter(Gson gson, TypeAdapter typeAdapter) { this.gson = gson; this.adapter = typeAdapter; } @Override // retrofit2.Converter public final RequestBody convert(T t) throws IOException { C15111ghZ c15111ghZ = new C15111ghZ(); JsonWriter newJsonWriter = this.gson.newJsonWriter(new OutputStreamWriter(new C15111ghZ.Sts(c15111ghZ), UTF_8)); this.adapter.write(newJsonWriter, t); newJsonWriter.close(); return RequestBody.create(MEDIA_TYPE, c15111ghZ.c(c15111ghZ.c)); } }