36 lines
1.3 KiB
Java
36 lines
1.3 KiB
Java
|
package com.google.firebase.crashlytics.internal.ndk;
|
||
|
|
||
|
import com.google.firebase.crashlytics.internal.common.CommonUtils;
|
||
|
import com.google.firebase.crashlytics.internal.ndk.BinaryImagesConverter;
|
||
|
import java.io.BufferedInputStream;
|
||
|
import java.io.File;
|
||
|
import java.io.FileInputStream;
|
||
|
import java.io.IOException;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
class Sha1FileIdStrategy implements BinaryImagesConverter.FileIdStrategy {
|
||
|
@Override // com.google.firebase.crashlytics.internal.ndk.BinaryImagesConverter.FileIdStrategy
|
||
|
public String createId(File file) throws IOException {
|
||
|
return getFileSHA(file.getPath());
|
||
|
}
|
||
|
|
||
|
private static String getFileSHA(String str) throws IOException {
|
||
|
BufferedInputStream bufferedInputStream;
|
||
|
try {
|
||
|
bufferedInputStream = new BufferedInputStream(new FileInputStream(str));
|
||
|
try {
|
||
|
String sha1 = CommonUtils.sha1(bufferedInputStream);
|
||
|
CommonUtils.closeQuietly(bufferedInputStream);
|
||
|
return sha1;
|
||
|
} catch (Throwable th) {
|
||
|
th = th;
|
||
|
CommonUtils.closeQuietly(bufferedInputStream);
|
||
|
throw th;
|
||
|
}
|
||
|
} catch (Throwable th2) {
|
||
|
th = th2;
|
||
|
bufferedInputStream = null;
|
||
|
}
|
||
|
}
|
||
|
}
|