<commit_before>import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class HttpUtil {
  public static int pipe(InputStream in, OutputStream out, int limit)
    throws IOException
  {
    byte[] buffer = new byte[8 * 1024];
    int total = 0;
    int c;
    while (limit < 0 || total < limit) {
      int max = buffer.length;
      if (limit >= 0 && max > (limit - total)) {
        max = limit - total;
      }
      c = in.read(buffer, 0, max);
      out.write(buffer, 0, c);
      total += c;
    }
    return total;
  }

  public static String readLine(InputStream in) throws IOException {
    StringBuilder sb = new StringBuilder();
    boolean sawCarriageReturn = false;
    while (true) {
      int c = in.read();
      switch (c) {
      case -1:
        return sb.length() > 0 ? sb.toString() : null;
     
      case '\r':
        sawCarriageReturn = true;
        break;

      case '\n':
        if (sawCarriageReturn) {
          return sb.toString();
        }
        // fall though

      default:
        sb.append((char) c);
        sawCarriageReturn = false;
        break;
      }<commit_msg>fix attempt to write -1 bytes in HttpUtil<commit_after>import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class HttpUtil {
  public static int pipe(InputStream in, OutputStream out, int limit)
    throws IOException
  {
    byte[] buffer = new byte[8 * 1024];
    int total = 0;
    while (limit < 0 || total < limit) {
      int max = buffer.length;
      if (limit >= 0 && max > (limit - total)) {
        max = limit - total;
      }
      int c = in.read(buffer, 0, max);
      if (c > 0) {
        out.write(buffer, 0, c);
        total += c;
      } else {
        break;
      }
    }
    return total;
  }

  public static String readLine(InputStream in) throws IOException {
    StringBuilder sb = new StringBuilder();
    boolean sawCarriageReturn = false;
    while (true) {
      int c = in.read();
      switch (c) {
      case -1:
        return sb.length() > 0 ? sb.toString() : null;
     
      case '\r':
        sawCarriageReturn = true;
        break;

      case '\n':
        if (sawCarriageReturn) {
          return sb.toString();
        }
        // fall though

      default:
        sb.append((char) c);
        sawCarriageReturn = false;
        break;
      }
{'fraction_non_alphanumeric': 0.11754827875734676, 'fraction_numerical': 0.0109151973131822, 'mean_word_length': 1.9060975609756097, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '7276467', 'n_tokens_mistral': 734, 'n_tokens_neox': 705, 'n_words': 221}