<commit_before>package com.mateoi.money.io;

/**
 * Created by mateo on 04/07/2017.
 */
public class FileIO {
}
<commit_msg>Added FileIO class<commit_after>package com.mateoi.money.io;

import com.mateoi.money.model.MainState;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

/**
 * Created by mateo on 04/07/2017.
 */
public class FileIO {
    private final static FileIO instance = new FileIO();

    private FileIO() {
    }

    public static FileIO getInstance() {
        return instance;
    }

    public void save(String location, MainState state) throws IOException {
        Path path = Paths.get(location);
        save(path, state);
    }

    public void save(Path path, MainState state) throws IOException {
        String lines = state.toString();
        Files.write(path, lines.getBytes());
    }

    public void load(String location) throws IOException {
        Path path = Paths.get(location);
        load(path);
    }

    public void load(Path path) throws IOException {
        List<String> lines = Files.readAllLines(path);
        Parser.getInstance().parseIntoMainState(lines);
    }

}

{'fraction_non_alphanumeric': 0.1113881961762261, 'fraction_numerical': 0.013300083125519535, 'mean_word_length': 2.9735973597359737, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1552698', 'n_tokens_mistral': 377, 'n_tokens_neox': 354, 'n_words': 95}