<commit_before><commit_msg>Util class added<commit_after>package tk.parmclee.o_droid;

import android.content.Context;
import android.net.Uri;
import android.os.Environment;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

public class Util {

    Uri getMapStorageUri(Context context){
        File storagePath;
        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            storagePath = Environment.getExternalStorageDirectory();
        } else storagePath = context.getFilesDir();
        storagePath = new File(storagePath.getAbsolutePath() + "/O-Droid Maps");
        storagePath.mkdirs();
        return Uri.parse(storagePath.getAbsolutePath());
    }

    void createTextFile(Uri uri, String name, String text){
        File storage = new File(uri.getPath());
        File file = new File(storage, name);
        file.mkdirs();
        try {
            RandomAccessFile raFile = new RandomAccessFile(file, "rw");
            raFile.writeUTF(text);
            raFile.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
{'fraction_non_alphanumeric': 0.10964912280701754, 'fraction_numerical': 0.0, 'mean_word_length': 2.9075342465753424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5843144', 'n_tokens_mistral': 319, 'n_tokens_neox': 312, 'n_words': 68}