- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
132 lines
4.3 KiB
Java
132 lines
4.3 KiB
Java
package com.fyber.inneractive.sdk.player.cache;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.Closeable;
|
|
import java.io.EOFException;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.nio.charset.Charset;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class n implements Closeable {
|
|
public final InputStream a;
|
|
public final Charset b;
|
|
public byte[] c;
|
|
public int d;
|
|
public int e;
|
|
|
|
public class a extends ByteArrayOutputStream {
|
|
public a(int i) {
|
|
super(i);
|
|
}
|
|
|
|
@Override // java.io.ByteArrayOutputStream
|
|
public final String toString() {
|
|
int i = ((ByteArrayOutputStream) this).count;
|
|
if (i > 0) {
|
|
int i2 = i - 1;
|
|
if (((ByteArrayOutputStream) this).buf[i2] == 13) {
|
|
i = i2;
|
|
}
|
|
}
|
|
try {
|
|
return new String(((ByteArrayOutputStream) this).buf, 0, i, n.this.b.name());
|
|
} catch (UnsupportedEncodingException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
public n(FileInputStream fileInputStream, Charset charset) {
|
|
charset.getClass();
|
|
if (!charset.equals(o.a)) {
|
|
throw new IllegalArgumentException("Unsupported encoding");
|
|
}
|
|
this.a = fileInputStream;
|
|
this.b = charset;
|
|
this.c = new byte[8192];
|
|
}
|
|
|
|
public final String a() throws IOException {
|
|
int i;
|
|
synchronized (this.a) {
|
|
try {
|
|
byte[] bArr = this.c;
|
|
if (bArr == null) {
|
|
throw new IOException("LineReader is closed");
|
|
}
|
|
if (this.d >= this.e) {
|
|
int read = this.a.read(bArr, 0, bArr.length);
|
|
if (read == -1) {
|
|
throw new EOFException();
|
|
}
|
|
this.d = 0;
|
|
this.e = read;
|
|
}
|
|
for (int i2 = this.d; i2 != this.e; i2++) {
|
|
byte[] bArr2 = this.c;
|
|
if (bArr2[i2] == 10) {
|
|
int i3 = this.d;
|
|
if (i2 != i3) {
|
|
i = i2 - 1;
|
|
if (bArr2[i] == 13) {
|
|
String str = new String(bArr2, i3, i - i3, this.b.name());
|
|
this.d = i2 + 1;
|
|
return str;
|
|
}
|
|
}
|
|
i = i2;
|
|
String str2 = new String(bArr2, i3, i - i3, this.b.name());
|
|
this.d = i2 + 1;
|
|
return str2;
|
|
}
|
|
}
|
|
a aVar = new a((this.e - this.d) + 80);
|
|
while (true) {
|
|
byte[] bArr3 = this.c;
|
|
int i4 = this.d;
|
|
aVar.write(bArr3, i4, this.e - i4);
|
|
this.e = -1;
|
|
InputStream inputStream = this.a;
|
|
byte[] bArr4 = this.c;
|
|
int read2 = inputStream.read(bArr4, 0, bArr4.length);
|
|
if (read2 == -1) {
|
|
throw new EOFException();
|
|
}
|
|
this.d = 0;
|
|
this.e = read2;
|
|
for (int i5 = 0; i5 != this.e; i5++) {
|
|
byte[] bArr5 = this.c;
|
|
if (bArr5[i5] == 10) {
|
|
int i6 = this.d;
|
|
if (i5 != i6) {
|
|
aVar.write(bArr5, i6, i5 - i6);
|
|
}
|
|
this.d = i5 + 1;
|
|
return aVar.toString();
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() throws IOException {
|
|
synchronized (this.a) {
|
|
try {
|
|
if (this.c != null) {
|
|
this.c = null;
|
|
this.a.close();
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
}
|