<commit_before>package adakite.process;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class StreamGobbler implements Runnable {

  private static class StreamGobblerThread extends Thread {

    private InputStream inputStream;
    private CopyOnWriteArrayList<String> gobbledOutput;

    private StreamGobblerThread() {}

    public StreamGobblerThread(InputStream inputStream) {
      this.inputStream = inputStream;
    }

    public List<String> getOutput() {
      List<String> ret = new ArrayList<>(this.gobbledOutput);
      return ret;
    }

    @Override
    public void run() {
      this.gobbledOutput.clear();

      try {
        BufferedReader br = new BufferedReader(new InputStreamReader(this.inputStream, StandardCharsets.UTF_8));
        String line;
        while ((line = br.readLine()) != null) {
          this.gobbledOutput.add(line);
        }
      } catch (Exception ex) {
        //TODO: Handle error.
      }
    }

  }

  private Thread thread;
  private StreamGobblerThread gobblerThread;
  private InputStream inputStream;

  private StreamGobbler() {}

  public StreamGobbler(InputStream inputStream) {
    this.inputStream = inputStream;
  }

  public List<String> getCurrentOutput() {
    return this.gobblerThread.getOutput();
  }

  public void interrupt() {
    this.thread.interrupt();
  }

  public boolean isInterrupted() {
    return this.thread.isInterrupted();
  }

  public boolean isAlive() {
    return this.thread.isAlive();
  }

  @Override
  public void run() {
    this.gobblerThread = new StreamGobblerThread(this.inputStream);
    this.thread = new Thread(this.gobblerThread);
    this.thread.start();
  }

}<commit_msg>Update StreamGobbler.java<commit_after>package adakite.process;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class StreamGobbler {

  private static class StreamGobblerRunnable implements Runnable {

    private InputStream inputStream;
    private CopyOnWriteArrayList<String> gobbledOutput;

    private StreamGobblerRunnable() {}

    public StreamGobblerRunnable(InputStream inputStream) {
      this.inputStream = inputStream;
      this.gobbledOutput = new CopyOnWriteArrayList<>();
    }

    public List<String> getOutput() {
      List<String> ret = new ArrayList<>(this.gobbledOutput);
      return ret;
    }

    @Override
    public void run() {
      this.gobbledOutput.clear();

      try {
        BufferedReader br = new BufferedReader(new InputStreamReader(this.inputStream, StandardCharsets.UTF_8));
        String line;
        while ((line = br.readLine()) != null) {
          this.gobbledOutput.add(line);
        }
      } catch (Exception ex) {
        //TODO: Handle error.
      }
    }

  }

  private Thread thread;
  private StreamGobblerRunnable runnable;

  private StreamGobbler() {}

  public StreamGobbler(InputStream inputStream) {
    this.runnable = new StreamGobblerRunnable(inputStream);
  }

  public List<String> getCurrentOutput() {
    return this.runnable.getOutput();
  }

  public void interrupt() {
    this.thread.interrupt();
  }

  public boolean isInterrupted() {
    return this.thread.isInterrupted();
  }

  public boolean isAlive() {
    return this.thread.isAlive();
  }

  public void run() {
    this.thread = new Thread(this.runnable);
    this.thread.start();
  }

}
{'fraction_non_alphanumeric': 0.10005408328826393, 'fraction_numerical': 0.0005408328826392645, 'mean_word_length': 3.4088200238379023, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '4924166', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1079, 'n_words': 236}