what-the-bank/sources/org/bouncycastle/asn1/x500/style/X500NameTokenizer.java

59 lines
1.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.x500.style;
/* loaded from: classes6.dex */
public class X500NameTokenizer {
private StringBuffer buf;
private int index;
private char separator;
private String value;
public String nextToken() {
if (this.index == this.value.length()) {
return null;
}
int i = this.index + 1;
this.buf.setLength(0);
boolean z = false;
boolean z2 = false;
while (i != this.value.length()) {
char charAt = this.value.charAt(i);
if (charAt == '\"') {
if (!z2) {
z = !z;
}
} else if (!z2 && !z) {
if (charAt != '\\') {
if (charAt == this.separator) {
break;
}
this.buf.append(charAt);
} else {
this.buf.append(charAt);
z2 = true;
}
i++;
}
this.buf.append(charAt);
z2 = false;
i++;
}
this.index = i;
return this.buf.toString();
}
public boolean hasMoreTokens() {
return this.index != this.value.length();
}
public X500NameTokenizer(String str, char c) {
this.buf = new StringBuffer();
this.value = str;
this.index = -1;
this.separator = c;
}
public X500NameTokenizer(String str) {
this(str, ',');
}
}