- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
222 lines
5.6 KiB
Java
222 lines
5.6 KiB
Java
package com.applovin.impl;
|
|
|
|
import com.applovin.impl.p1;
|
|
import java.nio.ByteBuffer;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class ak extends z1 {
|
|
private final long i;
|
|
private final long j;
|
|
private final short k;
|
|
private int l;
|
|
private boolean m;
|
|
private byte[] n;
|
|
private byte[] o;
|
|
private int p;
|
|
private int q;
|
|
private int r;
|
|
private boolean s;
|
|
private long t;
|
|
|
|
public void a(boolean z) {
|
|
this.m = z;
|
|
}
|
|
|
|
@Override // com.applovin.impl.z1, com.applovin.impl.p1
|
|
public boolean f() {
|
|
return this.m;
|
|
}
|
|
|
|
public long j() {
|
|
return this.t;
|
|
}
|
|
|
|
public ak() {
|
|
this(150000L, 20000L, (short) 1024);
|
|
}
|
|
|
|
@Override // com.applovin.impl.z1
|
|
public void h() {
|
|
int i = this.q;
|
|
if (i > 0) {
|
|
a(this.n, i);
|
|
}
|
|
if (this.s) {
|
|
return;
|
|
}
|
|
this.t += this.r / this.l;
|
|
}
|
|
|
|
@Override // com.applovin.impl.z1
|
|
public void g() {
|
|
if (this.m) {
|
|
this.l = this.b.d;
|
|
int a = a(this.i) * this.l;
|
|
if (this.n.length != a) {
|
|
this.n = new byte[a];
|
|
}
|
|
int a2 = a(this.j) * this.l;
|
|
this.r = a2;
|
|
if (this.o.length != a2) {
|
|
this.o = new byte[a2];
|
|
}
|
|
}
|
|
this.p = 0;
|
|
this.t = 0L;
|
|
this.q = 0;
|
|
this.s = false;
|
|
}
|
|
|
|
public ak(long j, long j2, short s) {
|
|
b1.a(j2 <= j);
|
|
this.i = j;
|
|
this.j = j2;
|
|
this.k = s;
|
|
byte[] bArr = xp.f;
|
|
this.n = bArr;
|
|
this.o = bArr;
|
|
}
|
|
|
|
@Override // com.applovin.impl.z1
|
|
public void i() {
|
|
this.m = false;
|
|
this.r = 0;
|
|
byte[] bArr = xp.f;
|
|
this.n = bArr;
|
|
this.o = bArr;
|
|
}
|
|
|
|
private void e(ByteBuffer byteBuffer) {
|
|
int limit = byteBuffer.limit();
|
|
int c = c(byteBuffer);
|
|
int position = c - byteBuffer.position();
|
|
byte[] bArr = this.n;
|
|
int length = bArr.length;
|
|
int i = this.q;
|
|
int i2 = length - i;
|
|
if (c < limit && position < i2) {
|
|
a(bArr, i);
|
|
this.q = 0;
|
|
this.p = 0;
|
|
return;
|
|
}
|
|
int min = Math.min(position, i2);
|
|
byteBuffer.limit(byteBuffer.position() + min);
|
|
byteBuffer.get(this.n, this.q, min);
|
|
int i3 = this.q + min;
|
|
this.q = i3;
|
|
byte[] bArr2 = this.n;
|
|
if (i3 == bArr2.length) {
|
|
if (this.s) {
|
|
a(bArr2, this.r);
|
|
this.t += (this.q - (this.r * 2)) / this.l;
|
|
} else {
|
|
this.t += (i3 - this.r) / this.l;
|
|
}
|
|
a(byteBuffer, this.n, this.q);
|
|
this.q = 0;
|
|
this.p = 2;
|
|
}
|
|
byteBuffer.limit(limit);
|
|
}
|
|
|
|
private void d(ByteBuffer byteBuffer) {
|
|
int remaining = byteBuffer.remaining();
|
|
a(remaining).put(byteBuffer).flip();
|
|
if (remaining > 0) {
|
|
this.s = true;
|
|
}
|
|
}
|
|
|
|
private int a(long j) {
|
|
return (int) ((j * this.b.a) / 1000000);
|
|
}
|
|
|
|
private int c(ByteBuffer byteBuffer) {
|
|
for (int position = byteBuffer.position(); position < byteBuffer.limit(); position += 2) {
|
|
if (Math.abs((int) byteBuffer.getShort(position)) > this.k) {
|
|
int i = this.l;
|
|
return i * (position / i);
|
|
}
|
|
}
|
|
return byteBuffer.limit();
|
|
}
|
|
|
|
private int b(ByteBuffer byteBuffer) {
|
|
int limit = byteBuffer.limit();
|
|
do {
|
|
limit -= 2;
|
|
if (limit < byteBuffer.position()) {
|
|
return byteBuffer.position();
|
|
}
|
|
} while (Math.abs((int) byteBuffer.getShort(limit)) <= this.k);
|
|
int i = this.l;
|
|
return ((limit / i) * i) + i;
|
|
}
|
|
|
|
private void f(ByteBuffer byteBuffer) {
|
|
int limit = byteBuffer.limit();
|
|
byteBuffer.limit(Math.min(limit, byteBuffer.position() + this.n.length));
|
|
int b = b(byteBuffer);
|
|
if (b == byteBuffer.position()) {
|
|
this.p = 1;
|
|
} else {
|
|
byteBuffer.limit(b);
|
|
d(byteBuffer);
|
|
}
|
|
byteBuffer.limit(limit);
|
|
}
|
|
|
|
private void g(ByteBuffer byteBuffer) {
|
|
int limit = byteBuffer.limit();
|
|
int c = c(byteBuffer);
|
|
byteBuffer.limit(c);
|
|
this.t += byteBuffer.remaining() / this.l;
|
|
a(byteBuffer, this.o, this.r);
|
|
if (c < limit) {
|
|
a(this.o, this.r);
|
|
this.p = 0;
|
|
byteBuffer.limit(limit);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.z1
|
|
public p1.a b(p1.a aVar) {
|
|
if (aVar.c == 2) {
|
|
return this.m ? aVar : p1.a.e;
|
|
}
|
|
throw new p1.b(aVar);
|
|
}
|
|
|
|
private void a(byte[] bArr, int i) {
|
|
a(i).put(bArr, 0, i).flip();
|
|
if (i > 0) {
|
|
this.s = true;
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.p1
|
|
public void a(ByteBuffer byteBuffer) {
|
|
while (byteBuffer.hasRemaining() && !a()) {
|
|
int i = this.p;
|
|
if (i == 0) {
|
|
f(byteBuffer);
|
|
} else if (i == 1) {
|
|
e(byteBuffer);
|
|
} else if (i == 2) {
|
|
g(byteBuffer);
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(ByteBuffer byteBuffer, byte[] bArr, int i) {
|
|
int min = Math.min(byteBuffer.remaining(), this.r);
|
|
int i2 = this.r - min;
|
|
System.arraycopy(bArr, i - i2, this.o, 0, i2);
|
|
byteBuffer.position(byteBuffer.limit() - min);
|
|
byteBuffer.get(this.o, i2, min);
|
|
}
|
|
}
|