140 lines
3.8 KiB
Java
140 lines
3.8 KiB
Java
package o;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.IOException;
|
|
import java.util.Iterator;
|
|
import java.util.Stack;
|
|
|
|
/* renamed from: o.ghU, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C15108ghU implements Cloneable {
|
|
public Stack<Sts> a;
|
|
public boolean c;
|
|
public boolean d;
|
|
public boolean e;
|
|
|
|
public C15108ghU() {
|
|
this.a = new Stack<>();
|
|
this.e = true;
|
|
this.d = false;
|
|
this.c = false;
|
|
}
|
|
|
|
private C15108ghU(Stack<Sts> stack, boolean z, boolean z2, boolean z3) {
|
|
this.a = stack;
|
|
this.e = z;
|
|
this.d = z2;
|
|
this.c = z3;
|
|
}
|
|
|
|
public final void a(int i) {
|
|
if (this.a.isEmpty()) {
|
|
return;
|
|
}
|
|
Sts peek = this.a.peek();
|
|
if (peek.c && peek.b == i) {
|
|
return;
|
|
}
|
|
peek.b = i;
|
|
peek.c = true;
|
|
if (peek.e.size() == peek.b) {
|
|
this.a.pop();
|
|
byte[] a = C15109ghW.a(i);
|
|
byte[] byteArray = peek.e.toByteArray();
|
|
c(a, 0, a.length);
|
|
c(byteArray, 0, byteArray.length);
|
|
this.e = true;
|
|
this.d = false;
|
|
this.c = false;
|
|
}
|
|
}
|
|
|
|
public final void c(byte[] bArr, int i, int i2) {
|
|
if (this.a.isEmpty()) {
|
|
return;
|
|
}
|
|
Sts peek = this.a.peek();
|
|
int size = peek.b - peek.e.size();
|
|
if (i2 > size) {
|
|
StringBuilder sb = new StringBuilder("Cannot process ");
|
|
sb.append(i2);
|
|
sb.append(" bytes! Only ");
|
|
sb.append(size);
|
|
sb.append(" bytes left in this TLV object ");
|
|
sb.append(peek);
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
peek.e.write(bArr, i, i2);
|
|
if (peek.e.size() != peek.b) {
|
|
this.e = false;
|
|
this.d = false;
|
|
this.c = true;
|
|
} else {
|
|
this.a.pop();
|
|
c(peek.e.toByteArray(), 0, peek.b);
|
|
this.e = true;
|
|
this.d = false;
|
|
this.c = false;
|
|
}
|
|
}
|
|
|
|
public final Object clone() {
|
|
return new C15108ghU((Stack) this.a.clone(), this.e, this.d, this.c);
|
|
}
|
|
|
|
public final String toString() {
|
|
return this.a.toString();
|
|
}
|
|
|
|
public final boolean e() {
|
|
Iterator<Sts> it = this.a.iterator();
|
|
while (it.hasNext()) {
|
|
if (!it.next().c) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/* renamed from: o.ghU$Sts */
|
|
/* loaded from: classes6.dex */
|
|
public class Sts implements Cloneable {
|
|
private C15108ghU a;
|
|
private int d;
|
|
public int b = Integer.MAX_VALUE;
|
|
public boolean c = false;
|
|
public ByteArrayOutputStream e = new ByteArrayOutputStream();
|
|
|
|
public Sts(C15108ghU c15108ghU, int i) {
|
|
this.a = c15108ghU;
|
|
this.d = i;
|
|
}
|
|
|
|
public final Object clone() {
|
|
Sts sts = new Sts(this.a, this.d);
|
|
sts.b = this.b;
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
sts.e = byteArrayOutputStream;
|
|
try {
|
|
byteArrayOutputStream.write(this.e.toByteArray());
|
|
} catch (IOException unused) {
|
|
}
|
|
return sts;
|
|
}
|
|
|
|
public final String toString() {
|
|
byte[] byteArray = this.e.toByteArray();
|
|
StringBuilder sb = new StringBuilder("[TLVStruct ");
|
|
sb.append(Integer.toHexString(this.d));
|
|
sb.append(", ");
|
|
sb.append(this.c ? Integer.valueOf(this.b) : "UNDEFINED");
|
|
sb.append(", ");
|
|
sb.append(ghS.c(byteArray));
|
|
sb.append("(");
|
|
sb.append(byteArray.length);
|
|
sb.append(") ]");
|
|
return sb.toString();
|
|
}
|
|
}
|
|
}
|