// Path: app/src/main/java/org/secuso/privacyfriendlyweather/database/AppDatabase.java
// public static final String DB_NAME = "PF_WEATHER_DB.db";


import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.preference.PreferenceManager;
import android.util.JsonWriter;
import android.util.Log;
import org.jetbrains.annotations.NotNull;
import org.secuso.privacyfriendlybackup.api.backup.DatabaseUtil;
import org.secuso.privacyfriendlybackup.api.backup.PreferenceUtil;
import org.secuso.privacyfriendlybackup.api.pfa.IBackupCreator;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.List;
import kotlin.Pair;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.secuso.privacyfriendlyweather.database.AppDatabase.DB_NAME;
package org.secuso.privacyfriendlyweather.backup;






public class BackupCreator implements IBackupCreator {
    @Override
    public void writeBackup(@NotNull Context context, @NotNull OutputStream outputStream) {
// lock application, so no changes can be made as long as this backup is created
        // depending on the size of the application - this could take a bit

        Log.d("PFA BackupCreator", "createBackup() started");
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, Charset.forName("UTF-8"));
        JsonWriter writer = new JsonWriter(outputStreamWriter);
        writer.setIndent("");

        try {
            writer.beginObject();
// Path: app/src/main/java/org/secuso/privacyfriendlyweather/database/AppDatabase.java
// public static final String DB_NAME = "PF_WEATHER_DB.db";


// Path: app/src/main/java/org/secuso/privacyfriendlyweather/backup/BackupCreator.java
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.preference.PreferenceManager;
import android.util.JsonWriter;
import android.util.Log;
import org.jetbrains.annotations.NotNull;
import org.secuso.privacyfriendlybackup.api.backup.DatabaseUtil;
import org.secuso.privacyfriendlybackup.api.backup.PreferenceUtil;
import org.secuso.privacyfriendlybackup.api.pfa.IBackupCreator;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.List;
import kotlin.Pair;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.secuso.privacyfriendlyweather.database.AppDatabase.DB_NAME;

package org.secuso.privacyfriendlyweather.backup;






public class BackupCreator implements IBackupCreator {
    @Override
    public void writeBackup(@NotNull Context context, @NotNull OutputStream outputStream) {
// lock application, so no changes can be made as long as this backup is created
        // depending on the size of the application - this could take a bit

        Log.d("PFA BackupCreator", "createBackup() started");
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, Charset.forName("UTF-8"));
        JsonWriter writer = new JsonWriter(outputStreamWriter);
        writer.setIndent("");

        try {
            writer.beginObject();
            SQLiteDatabase dataBase = SQLiteDatabase.openDatabase(context.getDatabasePath(DB_NAME).getPath(), null, SQLiteDatabase.OPEN_READONLY);