正在查看: 饼干视频 v4.1.0 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 饼干视频 v4.1.0 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.moqi.sdk.videocache;
import amc.cd.ऊऋऔऌअउअऌ.ईऌओओआऊउउईउ;
import amc.cd.ऊऋऔऌअउअऌ.ऐऊऐएओऔऔऋऐऐ;
import android.content.Context;
import android.net.Uri;
import com.moqi.sdk.utils.t;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class h {
private static final String j = "127.0.0.1";
private String a;
private final Object b;
private final ExecutorService c;
private final Map<String, i> d;
private final ServerSocket e;
private final int f;
private final Thread g;
private final e h;
private final l i;
public static final class b {
private static final long f = 536870912;
private File a;
private com.moqi.sdk.videocache.sourcestorage.c d;
private com.moqi.sdk.videocache.file.a c = new com.moqi.sdk.videocache.file.h(f);
private com.moqi.sdk.videocache.file.c b = new com.moqi.sdk.videocache.file.f();
private ऐऊऐएओऔऔऋऐऐ e = new ईऌओओआऊउउईउ();
public b(Context context) {
this.d = com.moqi.sdk.videocache.sourcestorage.d.a(context);
this.a = r.b(context);
}
public e b() {
return new e(this.a, this.b, this.c, this.d, this.e);
}
public b a(int i) {
this.c = new com.moqi.sdk.videocache.file.g(i);
return this;
}
public b a(long j) {
this.c = new com.moqi.sdk.videocache.file.h(j);
return this;
}
public b a(ऐऊऐएओऔऔऋऐऐ r1) {
this.e = (ऐऊऐएओऔऔऋऐऐ) m.a(r1);
return this;
}
public b a(com.moqi.sdk.videocache.file.a aVar) {
this.c = (com.moqi.sdk.videocache.file.a) m.a(aVar);
return this;
}
public b a(com.moqi.sdk.videocache.file.c cVar) {
this.b = (com.moqi.sdk.videocache.file.c) m.a(cVar);
return this;
}
public b a(File file) {
this.a = (File) m.a(file);
return this;
}
public h a() {
return new h(b());
}
}
public final class c implements Runnable {
private final Socket a;
public c(Socket socket) {
this.a = socket;
}
@Override
public void run() {
h.this.d(this.a);
}
}
public final class d implements Runnable {
private final CountDownLatch a;
public d(CountDownLatch countDownLatch) {
this.a = countDownLatch;
}
@Override
public void run() {
this.a.countDown();
h.this.e();
}
}
public h(Context context) {
this(new b(context).b());
}
private h(e eVar) {
this.a = "MoQi_HttpProxyCacheServer";
this.b = new Object();
this.c = Executors.newFixedThreadPool(8);
this.d = new ConcurrentHashMap();
this.h = (e) m.a(eVar);
try {
ServerSocket serverSocket = new ServerSocket(0, 8, InetAddress.getByName(j));
this.e = serverSocket;
int localPort = serverSocket.getLocalPort();
this.f = localPort;
k.a(j, localPort);
CountDownLatch countDownLatch = new CountDownLatch(1);
Thread thread = new Thread(new d(countDownLatch));
this.g = thread;
thread.start();
countDownLatch.await();
this.i = new l(j, localPort);
t.c(this.a, "Proxy cache server started. Is it alive? " + b());
} catch (IOException | InterruptedException e) {
this.c.shutdown();
throw new IllegalStateException("Error starting local proxy server", e);
}
}
private int a() {
int i;
synchronized (this.b) {
Iterator<i> it = this.d.values().iterator();
i = 0;
while (it.hasNext()) {
i += it.next().b();
}
}
return i;
}
private String a(String str) {
return String.format(Locale.US, "http://%s:%d/%s", j, Integer.valueOf(this.f), o.c(str));
}
private void a(File file) {
try {
this.h.c.a(file);
} catch (IOException e) {
t.c(this.a, e.getMessage() + "");
}
}
private void a(Throwable th) {
t.c(this.a, th.getMessage() + "");
}
private void a(Socket socket) {
try {
if (socket.isClosed()) {
return;
}
socket.close();
} catch (IOException e) {
a(new ProxyCacheException("Error closing socket", e));
}
}
private File b(String str) {
e eVar = this.h;
return new File(eVar.a, eVar.b.a(str));
}
private void b(Socket socket) {
try {
if (socket.isInputShutdown()) {
return;
}
socket.shutdownInput();
} catch (SocketException unused) {
t.c(this.a, "Releasing input stream… Socket is closed by client.");
} catch (IOException e) {
a(new ProxyCacheException("Error closing socket input stream", e));
}
}
private boolean b() {
return this.i.a(3, 70);
}
private i c(String str) throws ProxyCacheException {
i iVar;
synchronized (this.b) {
iVar = this.d.get(str);
if (iVar == null) {
iVar = new i(str, this.h);
this.d.put(str, iVar);
}
}
return iVar;
}
private void c(Socket socket) {
try {
if (socket.isOutputShutdown()) {
return;
}
socket.shutdownOutput();
} catch (IOException e) {
t.a(e);
}
}
private void d() {
synchronized (this.b) {
Iterator<i> it = this.d.values().iterator();
while (it.hasNext()) {
it.next().d();
}
this.d.clear();
}
}
public void d(Socket socket) {
String str;
StringBuilder sb;
try {
try {
f a2 = f.a(socket.getInputStream());
t.c(this.a, "Request to cache proxy:" + a2);
String b2 = o.b(a2.a);
if (this.i.a(b2)) {
this.i.a(socket);
} else {
c(b2).a(a2, socket);
}
e(socket);
str = this.a;
sb = new StringBuilder();
} catch (ProxyCacheException e) {
e = e;
a(new ProxyCacheException("Error processing request", e));
e(socket);
str = this.a;
sb = new StringBuilder();
} catch (SocketException unused) {
t.c(this.a, "Closing socket… Socket is closed by client.");
e(socket);
str = this.a;
sb = new StringBuilder();
} catch (IOException e2) {
e = e2;
a(new ProxyCacheException("Error processing request", e));
e(socket);
str = this.a;
sb = new StringBuilder();
}
sb.append("Opened connections: ");
sb.append(a());
t.c(str, sb.toString());
} catch (Throwable th) {
e(socket);
t.c(this.a, "Opened connections: " + a());
throw th;
}
}
public void e() {
while (!Thread.currentThread().isInterrupted()) {
try {
Socket accept = this.e.accept();
t.c(this.a, "Accept new socket " + accept);
this.c.submit(new c(accept));
} catch (IOException e) {
a(new ProxyCacheException("Error during waiting connection", e));
return;
}
}
}
private void e(Socket socket) {
b(socket);
c(socket);
a(socket);
}
public String a(String str, boolean z) {
if (!z || !e(str)) {
return b() ? a(str) : str;
}
File b2 = b(str);
a(b2);
return Uri.fromFile(b2).toString();
}
public void a(com.moqi.sdk.videocache.d dVar) {
m.a(dVar);
synchronized (this.b) {
Iterator<i> it = this.d.values().iterator();
while (it.hasNext()) {
it.next().b(dVar);
}
}
}
public void a(com.moqi.sdk.videocache.d dVar, String str) {
m.a(dVar, str);
synchronized (this.b) {
try {
c(str).a(dVar);
} catch (ProxyCacheException e) {
t.c(this.a, e.getMessage() + "");
}
}
}
public void b(com.moqi.sdk.videocache.d dVar, String str) {
m.a(dVar, str);
synchronized (this.b) {
try {
c(str).b(dVar);
} catch (ProxyCacheException e) {
t.c(this.a, e.getMessage() + "");
}
}
}
public void c() {
t.c(this.a, "Shutdown proxy server");
d();
this.h.d.a();
this.g.interrupt();
try {
if (this.e.isClosed()) {
return;
}
this.e.close();
} catch (IOException e) {
a(new ProxyCacheException("Error shutting down proxy server", e));
}
}
public String d(String str) {
return a(str, true);
}
public boolean e(String str) {
m.a(str, "Url can't be null!");
return b(str).exists();
}
}