ModV2.0.4 v1.86526672844804版本的 MD5 值为:ab8437a2d03fc69805a8b4199bd7fecb
以下内容为反编译后的 p.java 源代码,内容仅作参考
package com.joaomgcd.taskerm.net;
import android.net.Uri;
import c.f.b.w;
import com.joaomgcd.taskerm.net.n;
import com.joaomgcd.taskerm.util.af;
import com.joaomgcd.taskerm.util.an;
import com.joaomgcd.taskerm.util.ao;
import com.joaomgcd.taskerm.util.cd;
import com.joaomgcd.taskerm.util.cr;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
import net.dinglisch.android.taskerm.gs;
public final class p<TResult, TResultError extends af> extends o<f<TResult, TResultError>, TResult, TResultError> implements n {
private final cr f8185c;
public static final class a extends c.f.b.l implements c.f.a.b<String, Long> {
final OutputStream f8186a;
final w.c f8187b;
a(OutputStream outputStream, w.c cVar) {
super(1);
this.f8186a = outputStream;
this.f8187b = cVar;
}
@Override
public Long invoke(String str) {
return Long.valueOf(a(str));
}
public final long a(String str) {
c.f.b.k.b(str, "type");
w.c cVar = this.f8187b;
long j = cVar.f2027a;
OutputStream outputStream = this.f8186a;
cVar.f2027a = j + ab.a(outputStream, "Content-Type: " + str);
w.c cVar2 = this.f8187b;
cVar2.f2027a = cVar2.f2027a + ab.a(this.f8186a);
return this.f8187b.f2027a;
}
}
public static final class b extends c.f.b.l implements c.f.a.m<String, String, c.s> {
final OutputStream f8189b;
final w.c f8190c;
b(OutputStream outputStream, w.c cVar) {
super(2);
this.f8189b = outputStream;
this.f8190c = cVar;
}
@Override
public c.s invoke(String str, String str2) {
a(str, str2);
return c.s.f2131a;
}
public final void a(String str, String str2) {
c.f.b.k.b(str, "key");
c.f.b.k.b(str2, "value");
if (this.f8190c.f2027a > 0) {
this.f8190c.f2027a += ab.a(this.f8189b);
}
this.f8190c.f2027a += ab.b(this.f8189b);
this.f8190c.f2027a += p.a(p.this, this.f8189b, str, null, 2, null);
this.f8190c.f2027a += p.this.b(this.f8189b, "text/plain");
this.f8190c.f2027a += ab.a(this.f8189b);
this.f8190c.f2027a += ab.a(this.f8189b, str2);
}
}
public p(f<TResult, TResultError> fVar) {
super(fVar);
c.f.b.k.b(fVar, "args");
this.f8185c = fVar.o().c();
}
public long a(OutputStream outputStream, InputStream inputStream, Long l, cd cdVar, boolean z) throws IOException {
c.f.b.k.b(inputStream, "stream");
return n.a.a(this, outputStream, inputStream, l, cdVar, z);
}
@Override
protected cr a() {
return this.f8185c;
}
@Override
public Long c() {
Long b2 = ((f) b()).o().b();
if (b2 != null) {
return Long.valueOf(b2.longValue() + ((f) b()).n().length());
}
return null;
}
@Override
protected long b(HttpURLConnection httpURLConnection, boolean z) throws IOException {
c.f.b.k.b(httpURLConnection, "receiver$0");
OutputStream outputStream = null;
try {
String n = ((f) b()).n();
ab.a(httpURLConnection, ((f) b()).o().e());
OutputStream a2 = a(httpURLConnection, z);
try {
long a3 = a(a2, n, 0L, z);
if (a2 != null) {
a2.close();
}
if (!z) {
((f) b()).o().a().close();
}
return a3;
} catch (Throwable th) {
outputStream = a2;
th = th;
if (outputStream != null) {
outputStream.close();
}
if (!z) {
((f) b()).o().a().close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
private final long a(OutputStream outputStream, String str, long j, boolean z) {
String str2;
v o = ((f) b()).o();
String e2 = o.e();
String str3 = e2;
if (str3 == null || str3.length() == 0) {
long b2 = j + ab.b(outputStream);
HashMap<String, String> j2 = ((f) b()).j();
return b2 + ab.a(outputStream, str, j2 != null ? j2.get(ab.a()) : null) + ab.b(outputStream) + a(outputStream, z) + ab.c(outputStream);
}
long a2 = j + a(outputStream, str);
if (o instanceof x) {
str2 = ((x) o).f().getName();
c.f.b.k.a((Object) str2, "content.file.name");
} else {
str2 = e2;
}
return a2 + a(outputStream, e2, str2, z) + ab.c(outputStream) + ab.a(outputStream);
}
private final long a(OutputStream outputStream, String str) {
w.c cVar = new w.c();
cVar.f2027a = 0L;
b bVar = new b(outputStream, cVar);
HashMap<String, String> a2 = an.a((Uri) an.a((c.f.a.b) null, new c(str), 1, (Object) null));
if (a2.size() <= 0) {
bVar.a("body", str);
} else {
for (Map.Entry<String, String> entry : a2.entrySet()) {
bVar.a(entry.getKey(), entry.getValue());
}
}
cVar.f2027a += ab.a(outputStream);
return cVar.f2027a;
}
public static final class c extends c.f.b.l implements c.f.a.a<Uri> {
final String f8191a;
c(String str) {
super(0);
this.f8191a = str;
}
@Override
public final Uri invoke() {
return ao.C("http://test.com?" + this.f8191a);
}
}
static long a(p pVar, OutputStream outputStream, String str, String str2, int i, Object obj) {
if ((i & 2) != 0) {
str2 = null;
}
return pVar.a(outputStream, str, str2);
}
private final long a(OutputStream outputStream, String str, String str2) {
long a2 = ab.a(outputStream, "Content-Disposition: form-data; name=\"" + str + "\"");
if (str2 != null) {
a2 += ab.a(outputStream, "; filename=\"" + str2 + '\"');
}
return a2 + ab.a(outputStream);
}
static long a(p pVar, OutputStream outputStream, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = null;
}
return pVar.b(outputStream, str);
}
public final long b(OutputStream outputStream, String str) {
w.c cVar = new w.c();
cVar.f2027a = 0L;
a aVar = new a(outputStream, cVar);
if (str != null) {
return aVar.a(str);
}
if (((f) b()).o() instanceof x) {
String c2 = gs.c(((x) ((f) b()).o()).f());
String str2 = c2;
return str2 == null || str2.length() == 0 ? cVar.f2027a : aVar.a(c2);
}
return cVar.f2027a;
}
private final long a(OutputStream outputStream, String str, String str2, boolean z) throws IOException {
return ab.b(outputStream) + a(outputStream, str, str2) + a(this, outputStream, (String) null, 1, (Object) null) + ab.a(outputStream, "Content-Transfer-Encoding: binary") + ab.a(outputStream) + ab.a(outputStream) + a(outputStream, ((f) b()).o().a(), ((f) b()).o().b(), ((f) b()).i(), z);
}
private final long a(OutputStream outputStream, boolean z) throws IOException {
return ab.a(outputStream, "Content-Type: application/octet-stream") + ab.a(outputStream) + ab.a(outputStream) + a(outputStream, ((f) b()).o().a(), ((f) b()).o().b(), ((f) b()).i(), z);
}
}