<commit_before>package com.github.onsdigital.perkin.helper;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public abstract class FileHelper {

    public static void saveFile(byte[] bytes, String filename) throws IOException {

        Path path = Paths.get("target/" + filename);

        Files.write(path, bytes);

        System.out.println("FileHelper saved file target/" + filename);
    }

    public static byte[] loadFileAsBytes(String name) throws IOException {
        Path path = null;

        try {
            path = Paths.get(ClassLoader.getSystemResource(name).toURI());
        } catch (URISyntaxException e) {
            e.printStackTrace();
            throw new IOException("problem loading file: " + name, e);
        }

        return Files.readAllBytes(path);
    }
}<commit_msg>FileHelper changed so files loaded properly from classpath<commit_after>package com.github.onsdigital.perkin.helper;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public abstract class FileHelper {

    public static void saveFile(byte[] bytes, String filename) throws IOException {

        Path path = Paths.get("target/" + filename);

        Files.write(path, bytes);

        System.out.println("FileHelper saved file target/" + filename);
    }

    public static byte[] loadFileAsBytes(String filename) throws IOException {

        InputStream in = FileHelper.class.getClassLoader().getResourceAsStream(filename);
        System.out.println("loaded file:  " + filename + " as: " + in);
        return IOUtils.toByteArray(in);
    }
}
{'fraction_non_alphanumeric': 0.10903083700440529, 'fraction_numerical': 0.0, 'mean_word_length': 3.3261904761904764, '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': '6345948', 'n_tokens_mistral': 515, 'n_tokens_neox': 501, 'n_words': 126}