335 lines
9.5 KiB
Java
335 lines
9.5 KiB
Java
package com.facetec.sdk;
|
|
|
|
import java.io.EOFException;
|
|
import java.io.IOException;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.Charset;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public final class nd implements mr {
|
|
private ms b = new ms();
|
|
private boolean d;
|
|
private nk e;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public nd(nk nkVar) {
|
|
if (nkVar == null) {
|
|
throw new NullPointerException("source == null");
|
|
}
|
|
this.e = nkVar;
|
|
}
|
|
|
|
@Override // com.facetec.sdk.nk
|
|
public final long b(ms msVar, long j) throws IOException {
|
|
if (msVar == null) {
|
|
throw new IllegalArgumentException("sink == null");
|
|
}
|
|
if (j < 0) {
|
|
throw new IllegalArgumentException("byteCount < 0: ".concat(String.valueOf(j)));
|
|
}
|
|
if (this.d) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
if (this.b.e == 0 && this.e.b(this.b, 8192L) == -1) {
|
|
return -1L;
|
|
}
|
|
return this.b.b(msVar, Math.min(j, this.b.e));
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final boolean a() throws IOException {
|
|
if (this.d) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
return this.b.a() && this.e.b(this.b, 8192L) == -1;
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final void e(long j) throws IOException {
|
|
if (!d(j)) {
|
|
throw new EOFException();
|
|
}
|
|
}
|
|
|
|
private boolean d(long j) throws IOException {
|
|
if (j < 0) {
|
|
throw new IllegalArgumentException("byteCount < 0: ".concat(String.valueOf(j)));
|
|
}
|
|
if (this.d) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
while (this.b.e < j) {
|
|
if (this.e.b(this.b, 8192L) == -1) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final byte g() throws IOException {
|
|
e(1L);
|
|
return this.b.g();
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final mt b(long j) throws IOException {
|
|
e(j);
|
|
return this.b.b(j);
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final byte[] j(long j) throws IOException {
|
|
e(j);
|
|
return this.b.j(j);
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final void d(byte[] bArr) throws IOException {
|
|
try {
|
|
e(bArr.length);
|
|
this.b.d(bArr);
|
|
} catch (EOFException e) {
|
|
int i = 0;
|
|
while (this.b.e > 0) {
|
|
ms msVar = this.b;
|
|
int a = msVar.a(bArr, i, (int) msVar.e);
|
|
if (a == -1) {
|
|
throw new AssertionError();
|
|
}
|
|
i += a;
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
@Override // java.nio.channels.ReadableByteChannel
|
|
public final int read(ByteBuffer byteBuffer) throws IOException {
|
|
if (this.b.e == 0 && this.e.b(this.b, 8192L) == -1) {
|
|
return -1;
|
|
}
|
|
return this.b.read(byteBuffer);
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final String d(Charset charset) throws IOException {
|
|
if (charset == null) {
|
|
throw new IllegalArgumentException("charset == null");
|
|
}
|
|
this.b.d(this.e);
|
|
return this.b.d(charset);
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final String o() throws IOException {
|
|
return a(Long.MAX_VALUE);
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final String a(long j) throws IOException {
|
|
if (j < 0) {
|
|
throw new IllegalArgumentException("limit < 0: ".concat(String.valueOf(j)));
|
|
}
|
|
long j2 = j == Long.MAX_VALUE ? Long.MAX_VALUE : j + 1;
|
|
long d = d((byte) 10, 0L, j2);
|
|
if (d != -1) {
|
|
return this.b.d(d);
|
|
}
|
|
if (j2 < Long.MAX_VALUE && d(j2) && this.b.c(j2 - 1) == 13 && d(1 + j2) && this.b.c(j2) == 10) {
|
|
return this.b.d(j2);
|
|
}
|
|
ms msVar = new ms();
|
|
ms msVar2 = this.b;
|
|
msVar2.c(msVar, 0L, Math.min(32L, msVar2.c()));
|
|
StringBuilder sb = new StringBuilder("\\n not found: limit=");
|
|
sb.append(Math.min(this.b.c(), j));
|
|
sb.append(" content=");
|
|
sb.append(msVar.n().c());
|
|
sb.append((char) 8230);
|
|
throw new EOFException(sb.toString());
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final short i() throws IOException {
|
|
e(2L);
|
|
return this.b.i();
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final short j() throws IOException {
|
|
e(2L);
|
|
return this.b.j();
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final int h() throws IOException {
|
|
e(4L);
|
|
return this.b.h();
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final int f() throws IOException {
|
|
e(4L);
|
|
return this.b.f();
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:20:0x0030, code lost:
|
|
|
|
if (r0 == 0) goto L20;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:22:0x0046, code lost:
|
|
|
|
throw new java.lang.NumberFormatException(java.lang.String.format("Expected leading [0-9a-fA-F] character but was %#x", java.lang.Byte.valueOf(r2)));
|
|
*/
|
|
@Override // com.facetec.sdk.mr
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final long m() throws java.io.IOException {
|
|
/*
|
|
r5 = this;
|
|
r0 = 1
|
|
r5.e(r0)
|
|
r0 = 0
|
|
L6:
|
|
int r1 = r0 + 1
|
|
long r2 = (long) r1
|
|
boolean r2 = r5.d(r2)
|
|
if (r2 == 0) goto L47
|
|
com.facetec.sdk.ms r2 = r5.b
|
|
long r3 = (long) r0
|
|
byte r2 = r2.c(r3)
|
|
r3 = 48
|
|
if (r2 < r3) goto L1e
|
|
r3 = 57
|
|
if (r2 <= r3) goto L2e
|
|
L1e:
|
|
r3 = 97
|
|
if (r2 < r3) goto L26
|
|
r3 = 102(0x66, float:1.43E-43)
|
|
if (r2 <= r3) goto L2e
|
|
L26:
|
|
r3 = 65
|
|
if (r2 < r3) goto L30
|
|
r3 = 70
|
|
if (r2 > r3) goto L30
|
|
L2e:
|
|
r0 = r1
|
|
goto L6
|
|
L30:
|
|
if (r0 == 0) goto L33
|
|
goto L47
|
|
L33:
|
|
java.lang.Byte r0 = java.lang.Byte.valueOf(r2)
|
|
java.lang.Object[] r0 = new java.lang.Object[]{r0}
|
|
java.lang.NumberFormatException r1 = new java.lang.NumberFormatException
|
|
java.lang.String r2 = "Expected leading [0-9a-fA-F] character but was %#x"
|
|
java.lang.String r0 = java.lang.String.format(r2, r0)
|
|
r1.<init>(r0)
|
|
throw r1
|
|
L47:
|
|
com.facetec.sdk.ms r0 = r5.b
|
|
long r0 = r0.m()
|
|
return r0
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.facetec.sdk.nd.m():long");
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final void f(long j) throws IOException {
|
|
if (this.d) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
while (j > 0) {
|
|
if (this.b.e == 0 && this.e.b(this.b, 8192L) == -1) {
|
|
throw new EOFException();
|
|
}
|
|
long min = Math.min(j, this.b.c());
|
|
this.b.f(min);
|
|
j -= min;
|
|
}
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final long s() throws IOException {
|
|
return d((byte) 0, 0L, Long.MAX_VALUE);
|
|
}
|
|
|
|
private long d(byte b, long j, long j2) throws IOException {
|
|
if (this.d) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
if (j2 < 0) {
|
|
throw new IllegalArgumentException(String.format("fromIndex=%s toIndex=%s", 0L, Long.valueOf(j2)));
|
|
}
|
|
while (j < j2) {
|
|
long b2 = this.b.b(b, j, j2);
|
|
if (b2 == -1) {
|
|
long j3 = this.b.e;
|
|
if (j3 >= j2 || this.e.b(this.b, 8192L) == -1) {
|
|
break;
|
|
}
|
|
j = Math.max(j, j3);
|
|
} else {
|
|
return b2;
|
|
}
|
|
}
|
|
return -1L;
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr
|
|
public final boolean e(mt mtVar) throws IOException {
|
|
return a(mtVar, mtVar.i());
|
|
}
|
|
|
|
private boolean a(mt mtVar, int i) throws IOException {
|
|
if (this.d) {
|
|
throw new IllegalStateException("closed");
|
|
}
|
|
if (i < 0 || mtVar.i() < i) {
|
|
return false;
|
|
}
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
long j = i2;
|
|
if (!d(1 + j) || this.b.c(j) != mtVar.d(i2)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.facetec.sdk.nk, java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() throws IOException {
|
|
if (this.d) {
|
|
return;
|
|
}
|
|
this.d = true;
|
|
this.e.close();
|
|
this.b.t();
|
|
}
|
|
|
|
@Override // com.facetec.sdk.nk
|
|
public final nh b() {
|
|
return this.e.b();
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder("buffer(");
|
|
sb.append(this.e);
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
|
|
@Override // java.nio.channels.Channel
|
|
public final boolean isOpen() {
|
|
return !this.d;
|
|
}
|
|
|
|
@Override // com.facetec.sdk.mr, com.facetec.sdk.mv
|
|
public final ms d() {
|
|
return this.b;
|
|
}
|
|
}
|