k.java 源代码
package r;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.Map;
import r.b;
import r.m;
import r.s;
public abstract class k<T> implements Comparable<k<T>> {
private o A;
private b.a B;
private final s.a f25846q;
private final int f25847r;
private final String f25848s;
private final int f25849t;
private final m.a f25850u;
private Integer f25851v;
private l f25852w;
private boolean f25853x;
private boolean f25854y;
private boolean f25855z;
class a implements Runnable {
final String f25856q;
final long f25857r;
a(String str, long j6) {
this.f25856q = str;
this.f25857r = j6;
}
@Override
public void run() {
k.this.f25846q.a(this.f25856q, this.f25857r);
k.this.f25846q.b(toString());
}
}
public enum b {
LOW,
NORMAL,
HIGH,
IMMEDIATE
}
public k(int i6, String str, m.a aVar) {
s.a aVar2;
if (s.a.f25883c) {
aVar2 = new s.a();
} else {
aVar2 = null;
}
this.f25846q = aVar2;
this.f25853x = true;
this.f25854y = false;
this.f25855z = false;
this.B = null;
this.f25847r = i6;
this.f25848s = str;
this.f25850u = aVar;
J(new d());
this.f25849t = i(str);
}
private byte[] h(Map<String, String> map, String str) {
StringBuilder sb = new StringBuilder();
try {
for (Map.Entry<String, String> entry : map.entrySet()) {
sb.append(URLEncoder.encode(entry.getKey(), str));
sb.append('=');
sb.append(URLEncoder.encode(entry.getValue(), str));
sb.append('&');
}
return sb.toString().getBytes(str);
} catch (UnsupportedEncodingException e6) {
throw new RuntimeException("Encoding not supported: " + str, e6);
}
}
private static int i(String str) {
Uri parse;
String host;
if (!TextUtils.isEmpty(str) && (parse = Uri.parse(str)) != null && (host = parse.getHost()) != null) {
return host.hashCode();
}
return 0;
}
public int A() {
return this.f25849t;
}
public String B() {
return this.f25848s;
}
public boolean C() {
return this.f25855z;
}
public boolean D() {
return this.f25854y;
}
public void E() {
this.f25855z = true;
}
public r F(r rVar) {
return rVar;
}
public abstract m<T> G(i iVar);
public k<?> H(b.a aVar) {
this.B = aVar;
return this;
}
public k<?> I(l lVar) {
this.f25852w = lVar;
return this;
}
public k<?> J(o oVar) {
this.A = oVar;
return this;
}
public final k<?> K(int i6) {
this.f25851v = Integer.valueOf(i6);
return this;
}
public final k<?> L(boolean z6) {
this.f25853x = z6;
return this;
}
public final boolean M() {
return this.f25853x;
}
public void b(String str) {
if (s.a.f25883c) {
this.f25846q.a(str, Thread.currentThread().getId());
}
}
public void d() {
this.f25854y = true;
}
@Override
public int compareTo(k<T> kVar) {
b x6 = x();
b x7 = kVar.x();
if (x6 == x7) {
return this.f25851v.intValue() - kVar.f25851v.intValue();
}
return x7.ordinal() - x6.ordinal();
}
public void f(r rVar) {
m.a aVar = this.f25850u;
if (aVar != null) {
aVar.a(rVar);
}
}
public abstract void g(T t6);
public void k(String str) {
l lVar = this.f25852w;
if (lVar != null) {
lVar.b(this);
}
if (s.a.f25883c) {
long id = Thread.currentThread().getId();
if (Looper.myLooper() != Looper.getMainLooper()) {
new Handler(Looper.getMainLooper()).post(new a(str, id));
} else {
this.f25846q.a(str, id);
this.f25846q.b(toString());
}
}
}
public byte[] l() throws r.a {
Map<String, String> r6 = r();
if (r6 != null && r6.size() > 0) {
return h(r6, s());
}
return null;
}
public String m() {
return "application/x-www-form-urlencoded; charset=" + s();
}
public b.a n() {
return this.B;
}
public String o() {
return B();
}
public Map<String, String> p() throws r.a {
return Collections.emptyMap();
}
public int q() {
return this.f25847r;
}
protected Map<String, String> r() throws r.a {
return null;
}
protected String s() {
return "UTF-8";
}
@Deprecated
public byte[] t() throws r.a {
Map<String, String> v6 = v();
if (v6 != null && v6.size() > 0) {
return h(v6, w());
}
return null;
}
public String toString() {
String str;
String str2 = "0x" + Integer.toHexString(A());
StringBuilder sb = new StringBuilder();
if (this.f25854y) {
str = "[X] ";
} else {
str = "[ ] ";
}
sb.append(str);
sb.append(B());
sb.append(" ");
sb.append(str2);
sb.append(" ");
sb.append(x());
sb.append(" ");
sb.append(this.f25851v);
return sb.toString();
}
@Deprecated
public String u() {
return m();
}
@Deprecated
protected Map<String, String> v() throws r.a {
return r();
}
@Deprecated
protected String w() {
return s();
}
public b x() {
return b.NORMAL;
}
public o y() {
return this.A;
}
public final int z() {
return this.A.a();
}
}