Rabbit-R1/original r1/java/sources/tech/rabbit/r1launcher/wss/ByteArrayMediaDataSource.java

39 lines
1.1 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package tech.rabbit.r1launcher.wss;
import android.media.MediaDataSource;
import java.io.IOException;
/* loaded from: classes3.dex */
public class ByteArrayMediaDataSource extends MediaDataSource {
static final /* synthetic */ boolean $assertionsDisabled = false;
private final byte[] data;
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
}
public ByteArrayMediaDataSource(byte[] bArr) {
this.data = bArr;
}
@Override // android.media.MediaDataSource
public int readAt(long j, byte[] bArr, int i, int i2) throws IOException {
byte[] bArr2 = this.data;
if (j >= bArr2.length) {
return -1;
}
long j2 = i2;
long j3 = j + j2;
if (j3 > bArr2.length) {
i2 = (int) (j2 - (j3 - bArr2.length));
}
System.arraycopy(bArr2, (int) j, bArr, i, i2);
return i2;
}
@Override // android.media.MediaDataSource
public long getSize() throws IOException {
return this.data.length;
}
}