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

package com.mbridge.msdk.playercommon.exoplayer2.upstream;
import android.net.Uri;
import android.util.Base64;
import com.mbridge.msdk.playercommon.exoplayer2.ParserException;
import com.mbridge.msdk.playercommon.exoplayer2.util.Util;
import java.io.IOException;
import java.net.URLDecoder;
/* loaded from: classes4.dex */
public final class DataSchemeDataSource implements DataSource {
public static final String SCHEME_DATA = "data";
private int bytesRead;
private byte[] data;
private DataSpec dataSpec;
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final void close() throws IOException {
this.dataSpec = null;
this.data = null;
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final long open(DataSpec dataSpec) throws IOException {
this.dataSpec = dataSpec;
Uri uri = dataSpec.uri;
String scheme = uri.getScheme();
if (!"data".equals(scheme)) {
throw new ParserException("Unsupported scheme: " + scheme);
}
String[] split = Util.split(uri.getSchemeSpecificPart(), ",");
if (split.length != 2) {
throw new ParserException("Unexpected URI format: " + uri);
}
String str = split[1];
if (split[0].contains(";base64")) {
try {
this.data = Base64.decode(str, 0);
} catch (IllegalArgumentException e) {
throw new ParserException("Error while parsing Base64 encoded string: " + str, e);
}
} else {
this.data = URLDecoder.decode(str, "US-ASCII").getBytes();
}
return this.data.length;
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final int read(byte[] bArr, int i, int i2) {
if (i2 == 0) {
return 0;
}
int length = this.data.length - this.bytesRead;
if (length == 0) {
return -1;
}
int min = Math.min(i2, length);
System.arraycopy(this.data, this.bytesRead, bArr, i, min);
this.bytesRead += min;
return min;
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSource
public final Uri getUri() {
DataSpec dataSpec = this.dataSpec;
if (dataSpec != null) {
return dataSpec.uri;
}
return null;
}
}