<commit_before>/**
 * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.util;

import java.io.File;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

import com.opengamma.OpenGammaRuntimeException;

// NOTE kirk 2013-12-10 -- Before adding anything to this, check to see if
// the functionality you require is in another class or project
// (in particular IOUtils).
/**
 * A collection of utility methods for working with files.
 */
public final class FileUtils {
  private static final File TEMP_DIR = new File(System.getProperty("java.io.tmpdir"));
  
  private FileUtils() {
  }
  
  public static File copyResourceToTempFile(InputStream resource) {
    return copyResourceToTempFile(null, resource);
  }
  
  public static File copyResourceToTempFile(InputStream resource, String fileName) {
    return copyResourceToTempFile((String) null, resource, fileName);
  }
  
  public static File copyResourceToTempFile(String subdirName, InputStream resource) {
    return copyResourceToTempFile(subdirName, resource, null);
  }

  public static File copyResourceToTempFile(String subdirName, InputStream resource, String fileName) {
    File tempDir = TEMP_DIR;
    if (!(subdirName == null)) {
      tempDir = new File(TEMP_DIR, subdirName);<commit_msg>[PLAT-5424] Make TEMP_DIR public.<commit_after>/**
 * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.util;

import java.io.File;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

import com.opengamma.OpenGammaRuntimeException;

// NOTE kirk 2013-12-10 -- Before adding anything to this, check to see if
// the functionality you require is in another class or project
// (in particular IOUtils).
/**
 * A collection of utility methods for working with files.
 */
public final class FileUtils {
  /**
   * A convenience reference to the java.io.tmpdir location.
   */
  public static final File TEMP_DIR = new File(System.getProperty("java.io.tmpdir"));
  
  private FileUtils() {
  }
  
  public static File copyResourceToTempFile(InputStream resource) {
    return copyResourceToTempFile(null, resource);
  }
  
  public static File copyResourceToTempFile(InputStream resource, String fileName) {
    return copyResourceToTempFile((String) null, resource, fileName);
  }
  
  public static File copyResourceToTempFile(String subdirName, InputStream resource) {
    return copyResourceToTempFile(subdirName, resource, null);
  }

  public static File copyResourceToTempFile(String subdirName, InputStream resource, String fileName) {
    File tempDir = TEMP_DIR;
    if (!(subdirName == null)) {
      tempDir = new File(TEMP_DIR, subdirName);
{'fraction_non_alphanumeric': 0.08902181562280084, 'fraction_numerical': 0.009852216748768473, 'mean_word_length': 4.255083179297597, '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': '3139572', 'n_tokens_mistral': 815, 'n_tokens_neox': 805, 'n_words': 261}