Files
rr3-apk/decompiled/sources/com/google/firebase/remoteconfig/internal/ConfigStorageClient.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

90 lines
2.8 KiB
Java

package com.google.firebase.remoteconfig.internal;
import android.content.Context;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class ConfigStorageClient {
public static final Map clientInstances = new HashMap();
public final Context context;
public final String fileName;
public String getFileName() {
return this.fileName;
}
public ConfigStorageClient(Context context, String str) {
this.context = context;
this.fileName = str;
}
public synchronized Void write(ConfigContainer configContainer) {
FileOutputStream openFileOutput = this.context.openFileOutput(this.fileName, 0);
try {
openFileOutput.write(configContainer.toString().getBytes("UTF-8"));
} finally {
openFileOutput.close();
}
return null;
}
public synchronized ConfigContainer read() {
FileInputStream fileInputStream;
Throwable th;
try {
fileInputStream = this.context.openFileInput(this.fileName);
} catch (FileNotFoundException | JSONException unused) {
fileInputStream = null;
} catch (Throwable th2) {
fileInputStream = null;
th = th2;
}
try {
int available = fileInputStream.available();
byte[] bArr = new byte[available];
fileInputStream.read(bArr, 0, available);
ConfigContainer copyOf = ConfigContainer.copyOf(new JSONObject(new String(bArr, "UTF-8")));
fileInputStream.close();
return copyOf;
} catch (FileNotFoundException | JSONException unused2) {
if (fileInputStream != null) {
fileInputStream.close();
}
return null;
} catch (Throwable th3) {
th = th3;
if (fileInputStream != null) {
fileInputStream.close();
}
throw th;
}
}
public synchronized Void clear() {
this.context.deleteFile(this.fileName);
return null;
}
public static synchronized ConfigStorageClient getInstance(Context context, String str) {
ConfigStorageClient configStorageClient;
synchronized (ConfigStorageClient.class) {
try {
Map map = clientInstances;
if (!map.containsKey(str)) {
map.put(str, new ConfigStorageClient(context, str));
}
configStorageClient = (ConfigStorageClient) map.get(str);
} catch (Throwable th) {
throw th;
}
}
return configStorageClient;
}
}