110 lines
3.1 KiB
Java
110 lines
3.1 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class mVl {
|
|
private String a;
|
|
public int c;
|
|
public byte[] e;
|
|
|
|
public mVl(int i) {
|
|
this.a = null;
|
|
this.e = new byte[i];
|
|
this.c = 0;
|
|
}
|
|
|
|
public mVl(byte[] bArr) {
|
|
this.a = null;
|
|
this.e = bArr;
|
|
this.c = bArr.length;
|
|
}
|
|
|
|
public mVl(InputStream inputStream) throws IOException {
|
|
this.a = null;
|
|
this.c = 0;
|
|
this.e = new byte[16384];
|
|
while (true) {
|
|
int read = inputStream.read(this.e, this.c, 16384);
|
|
if (read <= 0) {
|
|
return;
|
|
}
|
|
int i = this.c + read;
|
|
this.c = i;
|
|
if (read != 16384) {
|
|
return;
|
|
} else {
|
|
e(i + 16384);
|
|
}
|
|
}
|
|
}
|
|
|
|
public mVl(byte[] bArr, int i, int i2) {
|
|
this.a = null;
|
|
if (i2 > bArr.length - i) {
|
|
throw new ArrayIndexOutOfBoundsException("Valid length exceeds the buffer length.");
|
|
}
|
|
byte[] bArr2 = new byte[i2];
|
|
this.e = bArr2;
|
|
System.arraycopy(bArr, i, bArr2, 0, i2);
|
|
this.c = i2;
|
|
}
|
|
|
|
public final void b(byte[] bArr, int i) {
|
|
e(this.c + i);
|
|
System.arraycopy(bArr, 0, this.e, this.c, i);
|
|
this.c += i;
|
|
}
|
|
|
|
public final String b() {
|
|
String str;
|
|
if (this.a == null) {
|
|
int i = this.c;
|
|
if (i < 2) {
|
|
this.a = "UTF-8";
|
|
} else {
|
|
byte[] bArr = this.e;
|
|
byte b = bArr[0];
|
|
if (b == 0) {
|
|
if (i < 4 || bArr[1] != 0) {
|
|
str = "UTF-16BE";
|
|
} else if ((bArr[2] & UnsignedBytes.MAX_VALUE) == 254 && (bArr[3] & UnsignedBytes.MAX_VALUE) == 255) {
|
|
str = "UTF-32BE";
|
|
} else {
|
|
this.a = "UTF-32";
|
|
}
|
|
this.a = str;
|
|
} else {
|
|
int i2 = b & UnsignedBytes.MAX_VALUE;
|
|
if (i2 < 128) {
|
|
if (bArr[1] != 0) {
|
|
this.a = "UTF-8";
|
|
} else {
|
|
this.a = (i < 4 || bArr[2] != 0) ? "UTF-16LE" : "UTF-32LE";
|
|
}
|
|
} else if (i2 == 239) {
|
|
this.a = "UTF-8";
|
|
} else if (i2 == 254 || i < 4 || bArr[2] != 0) {
|
|
this.a = "UTF-16";
|
|
} else {
|
|
this.a = "UTF-32";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return this.a;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final void e(int i) {
|
|
byte[] bArr = this.e;
|
|
if (i > bArr.length) {
|
|
byte[] bArr2 = new byte[bArr.length << 1];
|
|
this.e = bArr2;
|
|
System.arraycopy(bArr, 0, bArr2, 0, bArr.length);
|
|
}
|
|
}
|
|
}
|