Files
rr3-apk/decompiled/sources/com/mbridge/msdk/playercommon/exoplayer2/upstream/TeeDataSource.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

67 lines
2.2 KiB
Java

package com.mbridge.msdk.playercommon.exoplayer2.upstream;
import android.net.Uri;
import com.mbridge.msdk.playercommon.exoplayer2.util.Assertions;
import java.io.IOException;
/* loaded from: classes4.dex */
public final class TeeDataSource implements DataSource {
private long bytesRemaining;
private final DataSink dataSink;
private boolean dataSinkNeedsClosing;
private final DataSource upstream;
public TeeDataSource(DataSource dataSource, DataSink dataSink) {
this.upstream = (DataSource) Assertions.checkNotNull(dataSource);
this.dataSink = (DataSink) Assertions.checkNotNull(dataSink);
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final long open(DataSpec dataSpec) throws IOException {
long open = this.upstream.open(dataSpec);
this.bytesRemaining = open;
if (open == 0) {
return 0L;
}
if (dataSpec.length == -1 && open != -1) {
dataSpec = new DataSpec(dataSpec.uri, dataSpec.absoluteStreamPosition, dataSpec.position, open, dataSpec.key, dataSpec.flags);
}
this.dataSinkNeedsClosing = true;
this.dataSink.open(dataSpec);
return this.bytesRemaining;
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final int read(byte[] bArr, int i, int i2) throws IOException {
if (this.bytesRemaining == 0) {
return -1;
}
int read = this.upstream.read(bArr, i, i2);
if (read > 0) {
this.dataSink.write(bArr, i, read);
long j = this.bytesRemaining;
if (j != -1) {
this.bytesRemaining = j - read;
}
}
return read;
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final Uri getUri() {
return this.upstream.getUri();
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final void close() throws IOException {
try {
this.upstream.close();
} finally {
if (this.dataSinkNeedsClosing) {
this.dataSinkNeedsClosing = false;
this.dataSink.close();
}
}
}
}