<commit_before>package tech.zafrani.pubgapp.utils;

import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.gson.Gson;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;

import tech.zafrani.pubgapp.models.Category;
import tech.zafrani.pubgapp.models.Items;

public class FileUtil {

    @Nullable
    public static Items getItems(@NonNull final Activity activity) throws IOException {
        final InputStream inputStream = activity.getAssets().open("items.json");

        if (inputStream != null) {
            final Gson gson = new Gson();
            final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

            return bindItems(gson.fromJson(reader, Items.class));

        }
        return null;
    }

    public static Items bindItems(@NonNull Items items) {
        List<Category> categories = items.getCategories();
        for (Category category: categories){
            category.updateChildren();
        }
        return items;
    }

    @Nullable
    public static byte[] getBytesForFile(@NonNull final Context context,
                                         @NonNull final String filename) throws IOException {
        return IOUtils.toByteArray(context.getAssets().open(filename));
    }

}<commit_msg>fix: fileutil changes according to pr comments<commit_after>package tech.zafrani.pubgapp.utils;

import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.gson.Gson;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;

import tech.zafrani.pubgapp.models.Category;
import tech.zafrani.pubgapp.models.Items;

public class FileUtil {

    @Nullable
    public static Items getItems(@NonNull final Activity activity) throws IOException {
        final InputStream inputStream = activity.getAssets().open("items.json");

        if (inputStream != null) {
            final Gson gson = new Gson();
            final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

            return bindItems(gson.fromJson(reader, Items.class));

        }
        return null;
    }

    public static Items bindItems(@NonNull final Items items) {
        final List<Category> categories = items.getCategories();
        for (final Category category: categories){
            category.updateChildren();
        }
        return items;
    }

    @Nullable
    public static byte[] getBytesForFile(@NonNull final Context context,
                                         @NonNull final String filename) throws IOException {
        return IOUtils.toByteArray(context.getAssets().open(filename));
    }

}
{'fraction_non_alphanumeric': 0.09239307868103167, 'fraction_numerical': 0.0, 'mean_word_length': 3.1405405405405404, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '254141', 'n_tokens_mistral': 812, 'n_tokens_neox': 808, 'n_words': 201}