Files
rr3-apk/decompiled/sources/com/mbridge/msdk/playercommon/exoplayer2/upstream/DataSourceInputStream.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

72 lines
2.0 KiB
Java

package com.mbridge.msdk.playercommon.exoplayer2.upstream;
import androidx.annotation.NonNull;
import com.mbridge.msdk.playercommon.exoplayer2.util.Assertions;
import java.io.IOException;
import java.io.InputStream;
/* loaded from: classes4.dex */
public final class DataSourceInputStream extends InputStream {
private final DataSource dataSource;
private final DataSpec dataSpec;
private long totalBytesRead;
private boolean opened = false;
private boolean closed = false;
private final byte[] singleByteArray = new byte[1];
public final long bytesRead() {
return this.totalBytesRead;
}
public DataSourceInputStream(DataSource dataSource, DataSpec dataSpec) {
this.dataSource = dataSource;
this.dataSpec = dataSpec;
}
public final void open() throws IOException {
checkOpened();
}
@Override // java.io.InputStream
public final int read() throws IOException {
if (read(this.singleByteArray) == -1) {
return -1;
}
return this.singleByteArray[0] & 255;
}
@Override // java.io.InputStream
public final int read(@NonNull byte[] bArr) throws IOException {
return read(bArr, 0, bArr.length);
}
@Override // java.io.InputStream
public final int read(@NonNull byte[] bArr, int i, int i2) throws IOException {
Assertions.checkState(!this.closed);
checkOpened();
int read = this.dataSource.read(bArr, i, i2);
if (read == -1) {
return -1;
}
this.totalBytesRead += read;
return read;
}
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
if (this.closed) {
return;
}
this.dataSource.close();
this.closed = true;
}
private void checkOpened() throws IOException {
if (this.opened) {
return;
}
this.dataSource.open(this.dataSpec);
this.opened = true;
}
}