- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
73 lines
2.8 KiB
Java
73 lines
2.8 KiB
Java
package androidx.multidex;
|
|
|
|
import android.support.v4.media.session.PlaybackStateCompat;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.RandomAccessFile;
|
|
import java.util.zip.CRC32;
|
|
import java.util.zip.ZipException;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class ZipUtil {
|
|
private static final int BUFFER_SIZE = 16384;
|
|
private static final int ENDHDR = 22;
|
|
private static final int ENDSIG = 101010256;
|
|
|
|
public static class CentralDirectory {
|
|
long offset;
|
|
long size;
|
|
}
|
|
|
|
public static long getZipCrc(File file) throws IOException {
|
|
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");
|
|
try {
|
|
return computeCrcOfCentralDir(randomAccessFile, findCentralDirectory(randomAccessFile));
|
|
} finally {
|
|
randomAccessFile.close();
|
|
}
|
|
}
|
|
|
|
public static CentralDirectory findCentralDirectory(RandomAccessFile randomAccessFile) throws IOException, ZipException {
|
|
long length = randomAccessFile.length();
|
|
long j = length - 22;
|
|
if (j < 0) {
|
|
throw new ZipException("File too short to be a zip file: " + randomAccessFile.length());
|
|
}
|
|
long j2 = length - 65558;
|
|
long j3 = j2 >= 0 ? j2 : 0L;
|
|
int reverseBytes = Integer.reverseBytes(ENDSIG);
|
|
do {
|
|
randomAccessFile.seek(j);
|
|
if (randomAccessFile.readInt() == reverseBytes) {
|
|
randomAccessFile.skipBytes(2);
|
|
randomAccessFile.skipBytes(2);
|
|
randomAccessFile.skipBytes(2);
|
|
randomAccessFile.skipBytes(2);
|
|
CentralDirectory centralDirectory = new CentralDirectory();
|
|
centralDirectory.size = Integer.reverseBytes(randomAccessFile.readInt()) & 4294967295L;
|
|
centralDirectory.offset = Integer.reverseBytes(randomAccessFile.readInt()) & 4294967295L;
|
|
return centralDirectory;
|
|
}
|
|
j--;
|
|
} while (j >= j3);
|
|
throw new ZipException("End Of Central Directory signature not found");
|
|
}
|
|
|
|
public static long computeCrcOfCentralDir(RandomAccessFile randomAccessFile, CentralDirectory centralDirectory) throws IOException {
|
|
CRC32 crc32 = new CRC32();
|
|
long j = centralDirectory.size;
|
|
randomAccessFile.seek(centralDirectory.offset);
|
|
byte[] bArr = new byte[16384];
|
|
int read = randomAccessFile.read(bArr, 0, (int) Math.min(PlaybackStateCompat.ACTION_PREPARE, j));
|
|
while (read != -1) {
|
|
crc32.update(bArr, 0, read);
|
|
j -= read;
|
|
if (j == 0) {
|
|
break;
|
|
}
|
|
read = randomAccessFile.read(bArr, 0, (int) Math.min(PlaybackStateCompat.ACTION_PREPARE, j));
|
|
}
|
|
return crc32.getValue();
|
|
}
|
|
}
|