73 lines
2.5 KiB
Java
73 lines
2.5 KiB
Java
package o;
|
|
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.util.Arrays;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class gbK extends C14889gbJ {
|
|
public static final byte[] e(File file) {
|
|
C14957gcv.e(file, "");
|
|
FileInputStream fileInputStream = new FileInputStream(file);
|
|
try {
|
|
FileInputStream fileInputStream2 = fileInputStream;
|
|
long length = file.length();
|
|
if (length > 2147483647L) {
|
|
StringBuilder sb = new StringBuilder("File ");
|
|
sb.append(file);
|
|
sb.append(" is too big (");
|
|
sb.append(length);
|
|
sb.append(" bytes) to fit in memory.");
|
|
throw new OutOfMemoryError(sb.toString());
|
|
}
|
|
int i = (int) length;
|
|
byte[] bArr = new byte[i];
|
|
int i2 = i;
|
|
int i3 = 0;
|
|
while (i2 > 0) {
|
|
int read = fileInputStream2.read(bArr, i3, i2);
|
|
if (read < 0) {
|
|
break;
|
|
}
|
|
i2 -= read;
|
|
i3 += read;
|
|
}
|
|
if (i2 > 0) {
|
|
bArr = Arrays.copyOf(bArr, i3);
|
|
C14957gcv.c(bArr, "");
|
|
} else {
|
|
int read2 = fileInputStream2.read();
|
|
if (read2 != -1) {
|
|
gbE gbe = new gbE();
|
|
gbe.write(read2);
|
|
gbH.e(fileInputStream2, gbe, 8192);
|
|
int size = gbe.size() + i;
|
|
if (size < 0) {
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("File ");
|
|
sb2.append(file);
|
|
sb2.append(" is too big to fit in memory.");
|
|
throw new OutOfMemoryError(sb2.toString());
|
|
}
|
|
byte[] a = gbe.a();
|
|
bArr = Arrays.copyOf(bArr, size);
|
|
C14957gcv.c(bArr, "");
|
|
int size2 = gbe.size();
|
|
C14957gcv.e(a, "");
|
|
C14957gcv.e(bArr, "");
|
|
System.arraycopy(a, 0, bArr, i, size2);
|
|
}
|
|
}
|
|
gbF.d(fileInputStream, null);
|
|
return bArr;
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Throwable th2) {
|
|
gbF.d(fileInputStream, th);
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
}
|