what-the-bank/sources/o/hSC.java

79 lines
2.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.UnsupportedEncodingException;
import o.C15788ibz;
/* loaded from: classes.dex */
public abstract class hSC<T> extends HJP<T> {
protected static final String PROTOCOL_CHARSET = "utf-8";
private static final String PROTOCOL_CONTENT_TYPE = String.format("application/json; charset=%s", PROTOCOL_CHARSET);
private C15788ibz.LWm<T> mListener;
private final Object mLock;
private final String mRequestBody;
@Override // o.HJP
public abstract C15788ibz<T> parseNetworkResponse(DrQ drQ);
@Deprecated
public hSC(String str, String str2, C15788ibz.LWm<T> lWm, C15788ibz.HBt hBt) {
this(-1, str, str2, lWm, hBt);
}
public hSC(int i, String str, String str2, C15788ibz.LWm<T> lWm, C15788ibz.HBt hBt) {
super(i, str, hBt);
this.mLock = new Object();
this.mListener = lWm;
this.mRequestBody = str2;
}
@Override // o.HJP
public void cancel() {
super.cancel();
synchronized (this.mLock) {
this.mListener = null;
}
}
@Override // o.HJP
public void deliverResponse(T t) {
C15788ibz.LWm<T> lWm;
synchronized (this.mLock) {
lWm = this.mListener;
}
if (lWm != null) {
lWm.onResponse(t);
}
}
@Override // o.HJP
@Deprecated
public String getPostBodyContentType() {
return getBodyContentType();
}
@Override // o.HJP
@Deprecated
public byte[] getPostBody() {
return getBody();
}
@Override // o.HJP
public byte[] getBody() {
try {
String str = this.mRequestBody;
if (str != null) {
return str.getBytes(PROTOCOL_CHARSET);
}
return null;
} catch (UnsupportedEncodingException unused) {
qWd.c("Unsupported Encoding while trying to get the bytes of %s using %s", this.mRequestBody, PROTOCOL_CHARSET);
return null;
}
}
@Override // o.HJP
public String getBodyContentType() {
return PROTOCOL_CONTENT_TYPE;
}
}