<commit_before>package tlc2.util;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

import tlc2.tool.TLCState;
import util.FilenameToStream;

/**
 * State writer 
 * @author <NAME>
 * @version $Id$
 */
public class StateWriter
{
    private PrintWriter writer;
    private int stateNum;

    public StateWriter(String fname, FilenameToStream resolver) throws IOException
    {
        FileOutputStream fos = new FileOutputStream(fname);
        this.writer = new PrintWriter(new BufferedOutputStream(fos));
        this.stateNum = 1;
    }

    public synchronized void writeState(TLCState state)
    {
        this.writer.println("State " + this.stateNum + ":");
        this.writer.println(state.toString());
        this.stateNum++;
    }

    public final void close()
    {
        this.writer.close();
    }
}<commit_msg>FileUtil refactoring<commit_after>package tlc2.util;

import java.io.IOException;
import java.io.PrintWriter;

import tlc2.tool.TLCState;
import util.FileUtil;

/**
 * State writer 
 * @author <NAME>
 * @version $Id$
 */
public class StateWriter
{
    private PrintWriter writer;
    private int stateNum;

    public StateWriter(String fname) throws IOException
    {
        // SZ Feb 24, 2009: stream creation moved
        this.writer = new PrintWriter(FileUtil.newBFOS(fname));
        this.stateNum = 1;
    }

    public synchronized void writeState(TLCState state)
    {
        this.writer.println("State " + this.stateNum + ":");
        this.writer.println(state.toString());
        this.stateNum++;
    }

    public final void close()
    {
        this.writer.close();
    }
}
{'fraction_non_alphanumeric': 0.11084905660377359, 'fraction_numerical': 0.007075471698113208, 'mean_word_length': 2.9742388758782203, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6331449', 'n_tokens_mistral': 518, 'n_tokens_neox': 501, 'n_words': 117}