mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-30 11:02:31 -06:00
77 lines
2.3 KiB
Java
77 lines
2.3 KiB
Java
|
package androidx.media3.datasource;
|
||
|
|
||
|
import android.net.Uri;
|
||
|
import androidx.media3.common.util.Assertions;
|
||
|
import java.io.IOException;
|
||
|
import java.util.Collections;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class StatsDataSource implements DataSource {
|
||
|
private long bytesRead;
|
||
|
private final DataSource dataSource;
|
||
|
private Uri lastOpenedUri = Uri.EMPTY;
|
||
|
private Map<String, List<String>> lastResponseHeaders = Collections.emptyMap();
|
||
|
|
||
|
public long getBytesRead() {
|
||
|
return this.bytesRead;
|
||
|
}
|
||
|
|
||
|
public Uri getLastOpenedUri() {
|
||
|
return this.lastOpenedUri;
|
||
|
}
|
||
|
|
||
|
public Map<String, List<String>> getLastResponseHeaders() {
|
||
|
return this.lastResponseHeaders;
|
||
|
}
|
||
|
|
||
|
public void resetBytesRead() {
|
||
|
this.bytesRead = 0L;
|
||
|
}
|
||
|
|
||
|
public StatsDataSource(DataSource dataSource) {
|
||
|
this.dataSource = (DataSource) Assertions.checkNotNull(dataSource);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.media3.datasource.DataSource
|
||
|
public void addTransferListener(TransferListener transferListener) {
|
||
|
Assertions.checkNotNull(transferListener);
|
||
|
this.dataSource.addTransferListener(transferListener);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.media3.datasource.DataSource
|
||
|
public long open(DataSpec dataSpec) throws IOException {
|
||
|
this.lastOpenedUri = dataSpec.uri;
|
||
|
this.lastResponseHeaders = Collections.emptyMap();
|
||
|
long open = this.dataSource.open(dataSpec);
|
||
|
this.lastOpenedUri = (Uri) Assertions.checkNotNull(getUri());
|
||
|
this.lastResponseHeaders = getResponseHeaders();
|
||
|
return open;
|
||
|
}
|
||
|
|
||
|
@Override // androidx.media3.common.DataReader
|
||
|
public int read(byte[] bArr, int i, int i2) throws IOException {
|
||
|
int read = this.dataSource.read(bArr, i, i2);
|
||
|
if (read != -1) {
|
||
|
this.bytesRead += read;
|
||
|
}
|
||
|
return read;
|
||
|
}
|
||
|
|
||
|
@Override // androidx.media3.datasource.DataSource
|
||
|
public Uri getUri() {
|
||
|
return this.dataSource.getUri();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.media3.datasource.DataSource
|
||
|
public Map<String, List<String>> getResponseHeaders() {
|
||
|
return this.dataSource.getResponseHeaders();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.media3.datasource.DataSource
|
||
|
public void close() throws IOException {
|
||
|
this.dataSource.close();
|
||
|
}
|
||
|
}
|