2021-06-27 20:44:35 +00:00
|
|
|
package g0;
|
|
|
|
|
|
|
|
import d0.t.j;
|
|
|
|
import d0.z.d.m;
|
|
|
|
/* compiled from: Segment.kt */
|
|
|
|
public final class s {
|
|
|
|
public final byte[] a;
|
|
|
|
public int b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-04 15:26:29 +00:00
|
|
|
public int f2775c;
|
2021-06-27 20:44:35 +00:00
|
|
|
public boolean d;
|
|
|
|
public boolean e;
|
|
|
|
public s f;
|
|
|
|
public s g;
|
|
|
|
|
|
|
|
public s() {
|
|
|
|
this.a = new byte[8192];
|
|
|
|
this.e = true;
|
|
|
|
this.d = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public s(byte[] bArr, int i, int i2, boolean z2, boolean z3) {
|
|
|
|
m.checkParameterIsNotNull(bArr, "data");
|
|
|
|
this.a = bArr;
|
|
|
|
this.b = i;
|
2021-07-04 15:26:29 +00:00
|
|
|
this.f2775c = i2;
|
2021-06-27 20:44:35 +00:00
|
|
|
this.d = z2;
|
|
|
|
this.e = z3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final s a() {
|
|
|
|
s sVar = this.f;
|
|
|
|
if (sVar == this) {
|
|
|
|
sVar = null;
|
|
|
|
}
|
|
|
|
s sVar2 = this.g;
|
|
|
|
if (sVar2 == null) {
|
|
|
|
m.throwNpe();
|
|
|
|
}
|
|
|
|
sVar2.f = this.f;
|
|
|
|
s sVar3 = this.f;
|
|
|
|
if (sVar3 == null) {
|
|
|
|
m.throwNpe();
|
|
|
|
}
|
|
|
|
sVar3.g = this.g;
|
|
|
|
this.f = null;
|
|
|
|
this.g = null;
|
|
|
|
return sVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final s b(s sVar) {
|
|
|
|
m.checkParameterIsNotNull(sVar, "segment");
|
|
|
|
sVar.g = this;
|
|
|
|
sVar.f = this.f;
|
|
|
|
s sVar2 = this.f;
|
|
|
|
if (sVar2 == null) {
|
|
|
|
m.throwNpe();
|
|
|
|
}
|
|
|
|
sVar2.g = sVar;
|
|
|
|
this.f = sVar;
|
|
|
|
return sVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final s c() {
|
|
|
|
this.d = true;
|
2021-07-04 15:26:29 +00:00
|
|
|
return new s(this.a, this.b, this.f2775c, true, false);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void d(s sVar, int i) {
|
|
|
|
m.checkParameterIsNotNull(sVar, "sink");
|
|
|
|
if (sVar.e) {
|
2021-07-04 15:26:29 +00:00
|
|
|
int i2 = sVar.f2775c;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (i2 + i > 8192) {
|
|
|
|
if (!sVar.d) {
|
|
|
|
int i3 = sVar.b;
|
|
|
|
if ((i2 + i) - i3 <= 8192) {
|
|
|
|
byte[] bArr = sVar.a;
|
|
|
|
j.copyInto$default(bArr, bArr, 0, i3, i2, 2, (Object) null);
|
2021-07-04 15:26:29 +00:00
|
|
|
sVar.f2775c -= sVar.b;
|
2021-06-27 20:44:35 +00:00
|
|
|
sVar.b = 0;
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
byte[] bArr2 = this.a;
|
|
|
|
byte[] bArr3 = sVar.a;
|
2021-07-04 15:26:29 +00:00
|
|
|
int i4 = sVar.f2775c;
|
2021-06-27 20:44:35 +00:00
|
|
|
int i5 = this.b;
|
|
|
|
j.copyInto(bArr2, bArr3, i4, i5, i5 + i);
|
2021-07-04 15:26:29 +00:00
|
|
|
sVar.f2775c += i;
|
2021-06-27 20:44:35 +00:00
|
|
|
this.b += i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new IllegalStateException("only owner can write".toString());
|
|
|
|
}
|
|
|
|
}
|