<commit_before>package com.stripe.net;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URLConnection;
import java.util.Random;

public class MultipartProcessor {
  private final String boundary;
  private static final String LINE_BREAK = "\r\n";
  private OutputStream outputStream;
  private PrintWriter writer;
  private String charset;
  private java.net.HttpURLConnection conn;

  /**
   * Generates a random MIME multipart boundary.
   *
   * @return boundary value
   */
  public static String getBoundary() {
    Random random = new Random();
    Long positiveRandomLong = Math.abs(random.nextLong());
    return String.valueOf(positiveRandomLong);
  }

  /**
   * Constructs a new multipart body builder.
   */
  public MultipartProcessor(java.net.HttpURLConnection conn, String boundary, String charset)
      throws IOException {
    this.boundary = boundary;
    this.charset = charset;
    this.conn = conn;

    this.outputStream = conn.getOutputStream();
    this.writer = new PrintWriter(new OutputStreamWriter(outputStream, charset), true);
  }

  /**
   * Adds a form field to the multipart message.
   *
   * @param name field name
   * @param value field value
   */
  public void addFormField(String name, String value) {
    writer.append("--" + boundary).append(LINE_BREAK);
    writer.append("Content-Disposition: form-data; name=\"" + name + "\"")
        .append(LINE_BREAK);
    writer.append(LINE_BREAK);
    writer.append(value).append(LINE_BREAK);
    writer.flush();
  }

  /**<commit_msg>Remove unused attributes on MultipartProcessor<commit_after>package com.stripe.net;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URLConnection;
import java.util.Random;

public class MultipartProcessor {
  private final String boundary;
  private static final String LINE_BREAK = "\r\n";
  private OutputStream outputStream;
  private PrintWriter writer;

  /**
   * Generates a random MIME multipart boundary.
   *
   * @return boundary value
   */
  public static String getBoundary() {
    Random random = new Random();
    Long positiveRandomLong = Math.abs(random.nextLong());
    return String.valueOf(positiveRandomLong);
  }

  /**
   * Constructs a new multipart body builder.
   */
  public MultipartProcessor(java.net.HttpURLConnection conn, String boundary, String charset)
      throws IOException {
    this.boundary = boundary;

    this.outputStream = conn.getOutputStream();
    this.writer = new PrintWriter(new OutputStreamWriter(outputStream, charset), true);
  }

  /**
   * Adds a form field to the multipart message.
   *
   * @param name field name
   * @param value field value
   */
  public void addFormField(String name, String value) {
    writer.append("--" + boundary).append(LINE_BREAK);
    writer.append("Content-Disposition: form-data; name=\"" + name + "\"")
        .append(LINE_BREAK);
    writer.append(LINE_BREAK);
    writer.append(value).append(LINE_BREAK);
    writer.flush();
  }

  /**
{'fraction_non_alphanumeric': 0.10939431396786156, 'fraction_numerical': 0.0, 'mean_word_length': 3.7255474452554744, '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': '7244549', 'n_tokens_mistral': 958, 'n_tokens_neox': 922, 'n_words': 246}