<commit_before>import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;

import javax.swing.JEditorPane;
import javax.swing.JTextArea;
import javax.tools.*;

public class Compiler {
    // private OutputStream errorStream = null;
    private JEditorPane source;
    private JTextArea output;
    private boolean isCompiled = false;
    private JavaCompiler theCompiler = ToolProvider.getSystemJavaCompiler();
    private OutputStream errorStream = new OutputStream() {
        public void write(int b) {
            output.append(String.valueOf((char) b));
        }
    };

    public Compiler() {

    }

    public void setCompiled(boolean state) {
        isCompiled = true;
    }

    public void compile(String fileName) {
        File sourceFile = new File(fileName);

        try {
            BufferedWriter fileOut = new BufferedWriter(new FileWriter(
                    sourceFile));
            source.write(fileOut);
        } catch (IOException e) {
            // Do nothing
        }

        output.append("\nCompiling " + fileName + "...\n");
        int status = theCompiler.run(null, null, errorStream,
                sourceFile.getName());
        if (status == 0) {
            output.append("Compilation successful. No errors detected.");
            isCompiled = true;
        } else {
            output.append("Compilation failed.");
        }
    }

    public void setOutput(JTextArea output) {
        this.output = output;
    }

    public void setSource(JEditorPane source) {
        this.source = source;
    }
}<commit_msg>Passed stream handling responsibility to the LearningConsole class<commit_after>import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import javax.swing.JEditorPane;
import javax.tools.*;

public class Compiler {
    private JEditorPane source;
    private LearningConsole output;
    private boolean isCompiled = false;
    private JavaCompiler theCompiler = ToolProvider.getSystemJavaCompiler();
    
    public Compiler(JEditorPane source, LearningConsole output) {
        this.source = source;
        this.output = output;
    }
    
    public void setCompiled(boolean state) {
        isCompiled = true;
    }

    public void compile(String fileName) {
        File sourceFile = new File(fileName);

        try {
            BufferedWriter fileOut = new BufferedWriter(new FileWriter(
                    sourceFile));
            source.write(fileOut);
        } catch (IOException e) {
            // Do nothing
        }

        output.append("\nCompiling " + fileName + "...\n");
        int status = theCompiler.run(null, null, output.getStream(),
                sourceFile.getName());
        if (status == 0) {
            output.append("Compilation successful. No errors detected.");
            isCompiled = true;
        } else {
            output.append("Compilation failed.");
        }
    }

    public void setSource(JEditorPane source) {
        this.source = source;
    }
}
{'fraction_non_alphanumeric': 0.09689922480620156, 'fraction_numerical': 0.0006459948320413437, 'mean_word_length': 2.2876857749469215, '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': '6841369', 'n_tokens_mistral': 822, 'n_tokens_neox': 806, 'n_words': 211}