127 lines
4.1 KiB
Java
127 lines
4.1 KiB
Java
|
package o;
|
||
|
|
||
|
import java.io.ByteArrayOutputStream;
|
||
|
import java.io.Closeable;
|
||
|
import java.io.EOFException;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InputStream;
|
||
|
import java.io.UnsupportedEncodingException;
|
||
|
import java.nio.charset.Charset;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: o.rRy, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class C16809rRy implements Closeable {
|
||
|
int a;
|
||
|
private byte[] b;
|
||
|
private final InputStream c;
|
||
|
private int d;
|
||
|
final Charset e;
|
||
|
|
||
|
public C16809rRy(InputStream inputStream, Charset charset) {
|
||
|
this(inputStream, charset, (byte) 0);
|
||
|
}
|
||
|
|
||
|
private C16809rRy(InputStream inputStream, Charset charset, byte b) {
|
||
|
if (inputStream == null || charset == null) {
|
||
|
throw null;
|
||
|
}
|
||
|
if (!charset.equals(oSN.e)) {
|
||
|
throw new IllegalArgumentException("Unsupported encoding");
|
||
|
}
|
||
|
this.c = inputStream;
|
||
|
this.e = charset;
|
||
|
this.b = new byte[8192];
|
||
|
}
|
||
|
|
||
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
||
|
public final void close() throws IOException {
|
||
|
synchronized (this.c) {
|
||
|
if (this.b != null) {
|
||
|
this.b = null;
|
||
|
this.c.close();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final String e() throws IOException {
|
||
|
int i;
|
||
|
byte[] bArr;
|
||
|
int i2;
|
||
|
synchronized (this.c) {
|
||
|
if (this.b == null) {
|
||
|
throw new IOException("LineReader is closed");
|
||
|
}
|
||
|
if (this.d >= this.a) {
|
||
|
d();
|
||
|
}
|
||
|
for (int i3 = this.d; i3 != this.a; i3++) {
|
||
|
byte[] bArr2 = this.b;
|
||
|
if (bArr2[i3] == 10) {
|
||
|
int i4 = this.d;
|
||
|
if (i3 != i4) {
|
||
|
i2 = i3 - 1;
|
||
|
if (bArr2[i2] == 13) {
|
||
|
String str = new String(bArr2, i4, i2 - i4, this.e.name());
|
||
|
this.d = i3 + 1;
|
||
|
return str;
|
||
|
}
|
||
|
}
|
||
|
i2 = i3;
|
||
|
String str2 = new String(bArr2, i4, i2 - i4, this.e.name());
|
||
|
this.d = i3 + 1;
|
||
|
return str2;
|
||
|
}
|
||
|
}
|
||
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(this, (this.a - this.d) + 80) { // from class: o.rRy.1
|
||
|
private C16809rRy b;
|
||
|
|
||
|
{
|
||
|
this.b = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.io.ByteArrayOutputStream
|
||
|
public final String toString() {
|
||
|
try {
|
||
|
return new String(((ByteArrayOutputStream) this).buf, 0, (((ByteArrayOutputStream) this).count <= 0 || ((ByteArrayOutputStream) this).buf[((ByteArrayOutputStream) this).count + (-1)] != 13) ? ((ByteArrayOutputStream) this).count : ((ByteArrayOutputStream) this).count - 1, this.b.e.name());
|
||
|
} catch (UnsupportedEncodingException e) {
|
||
|
throw new AssertionError(e);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
loop1: while (true) {
|
||
|
byte[] bArr3 = this.b;
|
||
|
int i5 = this.d;
|
||
|
byteArrayOutputStream.write(bArr3, i5, this.a - i5);
|
||
|
this.a = -1;
|
||
|
d();
|
||
|
i = this.d;
|
||
|
while (i != this.a) {
|
||
|
bArr = this.b;
|
||
|
if (bArr[i] == 10) {
|
||
|
break loop1;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
int i6 = this.d;
|
||
|
if (i != i6) {
|
||
|
byteArrayOutputStream.write(bArr, i6, i - i6);
|
||
|
}
|
||
|
this.d = i + 1;
|
||
|
return byteArrayOutputStream.toString();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void d() throws IOException {
|
||
|
InputStream inputStream = this.c;
|
||
|
byte[] bArr = this.b;
|
||
|
int read = inputStream.read(bArr, 0, bArr.length);
|
||
|
if (read == -1) {
|
||
|
throw new EOFException();
|
||
|
}
|
||
|
this.d = 0;
|
||
|
this.a = read;
|
||
|
}
|
||
|
}
|