q.java 源代码
package com.moat.analytics.mobile.inm;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
class q {
q() {
}
public static com.moat.analytics.mobile.inm.a.b.a<String> a(String str) {
InputStream inputStream = null;
try {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.setConnectTimeout(15000);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoInput(true);
httpURLConnection.connect();
if (httpURLConnection.getResponseCode() >= 400) {
return com.moat.analytics.mobile.inm.a.b.a.a();
}
InputStream inputStream2 = httpURLConnection.getInputStream();
com.moat.analytics.mobile.inm.a.b.a<String> a7 = com.moat.analytics.mobile.inm.a.b.a.a(a(inputStream2));
if (inputStream2 != null) {
try {
inputStream2.close();
} catch (IOException unused) {
}
}
return a7;
} catch (IOException unused2) {
com.moat.analytics.mobile.inm.a.b.a<String> a8 = com.moat.analytics.mobile.inm.a.b.a.a();
if (0 != 0) {
try {
inputStream.close();
} catch (IOException unused3) {
}
}
return a8;
}
} catch (Throwable th) {
if (0 != 0) {
try {
inputStream.close();
} catch (IOException unused4) {
}
}
throw th;
}
}
public static void b(final String str) {
new Thread() {
@Override
public final void run() {
try {
q.a(str);
} catch (Exception unused) {
}
}
}.start();
}
private static String a(InputStream inputStream) {
char[] cArr = new char[256];
StringBuilder sb = new StringBuilder();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
int i6 = 0;
do {
int read = inputStreamReader.read(cArr, 0, 256);
if (read <= 0) {
break;
}
i6 += read;
sb.append(cArr, 0, read);
} while (i6 < 1024);
return sb.toString();
}
}