package o; import java.util.Arrays; /* renamed from: o.giy, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C15170giy { public C15170giy a; public boolean b; public final byte[] c; public int d; public int e; public C15170giy h; public boolean i; public C15170giy() { this.c = new byte[8192]; this.b = true; this.i = false; } public C15170giy(byte[] bArr, int i, int i2, boolean z, boolean z2) { C14957gcv.e(bArr, ""); this.c = bArr; this.e = i; this.d = i2; this.i = z; this.b = z2; } public final C15170giy b() { byte[] bArr = this.c; byte[] copyOf = Arrays.copyOf(bArr, bArr.length); C14957gcv.c(copyOf, ""); return new C15170giy(copyOf, this.e, this.d, false, true); } public final C15170giy d() { C15170giy c15170giy = this.a; if (c15170giy == this) { c15170giy = null; } C15170giy c15170giy2 = this.h; C14957gcv.e(c15170giy2); c15170giy2.a = this.a; C15170giy c15170giy3 = this.a; C14957gcv.e(c15170giy3); c15170giy3.h = this.h; this.a = null; this.h = null; return c15170giy; } public final C15170giy b(C15170giy c15170giy) { C14957gcv.e(c15170giy, ""); c15170giy.h = this; c15170giy.a = this.a; C15170giy c15170giy2 = this.a; C14957gcv.e(c15170giy2); c15170giy2.h = c15170giy; this.a = c15170giy; return c15170giy; } public final void d(C15170giy c15170giy, int i) { C14957gcv.e(c15170giy, ""); if (!c15170giy.b) { throw new IllegalStateException("only owner can write".toString()); } int i2 = c15170giy.d; int i3 = i2 + i; if (i3 > 8192) { if (c15170giy.i) { throw new IllegalArgumentException(); } int i4 = c15170giy.e; if (i3 - i4 > 8192) { throw new IllegalArgumentException(); } byte[] bArr = c15170giy.c; C14957gcv.e(bArr, ""); C14957gcv.e(bArr, ""); System.arraycopy(bArr, i4, bArr, 0, i2 - i4); c15170giy.d -= c15170giy.e; c15170giy.e = 0; } byte[] bArr2 = this.c; byte[] bArr3 = c15170giy.c; int i5 = c15170giy.d; int i6 = this.e; C14957gcv.e(bArr2, ""); C14957gcv.e(bArr3, ""); System.arraycopy(bArr2, i6, bArr3, i5, (i6 + i) - i6); c15170giy.d += i; this.e += i; } /* renamed from: o.giy$Sts */ /* loaded from: classes.dex */ public static final class Sts { private Sts() { } public /* synthetic */ Sts(byte b) { this(); } } static { new Sts((byte) 0); } }