// Path: src/main/java/org/fest/util/Arrays.java
// public static <T> boolean isNullOrEmpty(@Nullable T[] array) {
//   return array == null || !hasElements(array);
// }
// 
// Path: src/main/java/org/fest/util/Closeables.java
// public static void closeQuietly(@NotNull Closeable... closeables) {
//   for (Closeable c : closeables) {
//     close(c);
//   }
// }
// 
// Path: src/main/java/org/fest/util/Flushables.java
// public static void flushQuietly(@NotNull Flushable... flushables) {
//   for (Flushable f : flushables) {
//     flush(f);
//   }
// }
// 
// Path: src/main/java/org/fest/util/Preconditions.java
// public static @NotNull <T> T checkNotNull(@Nullable T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }
// 
// Path: src/main/java/org/fest/util/Strings.java
// public static @NotNull StringToAppend append(@NotNull String toAppend) {
//   return new StringToAppend(toAppend);
// }
// 
// Path: src/main/java/org/fest/util/Strings.java
// public static @Nullable String quote(@Nullable String s) {
//   return s != null ? String.format("'%s'", s) : null;
// }


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import static java.io.File.separator;
import static java.lang.String.format;
import static org.fest.util.Arrays.isNullOrEmpty;
import static org.fest.util.Closeables.closeQuietly;
import static org.fest.util.Flushables.flushQuietly;
import static org.fest.util.Preconditions.checkNotNull;
import static org.fest.util.Strings.append;
import static org.fest.util.Strings.quote;
  public static @NotNull File newTemporaryFile() {
    String tempFileName = String.format("%d.%s", System.currentTimeMillis(), ".txt");
    return newFile(temporaryFolderPath() + tempFileName);
  }

  /**
   * Creates a new directory in the system's temporary directory. The name of the directory will be the result of:
   * <p/>
   * <pre>
   * System.currentTimeMillis();
   * </pre>
   *
   * @return the created file.
   */
  public static @NotNull File newTemporaryFolder() {
    String tempFileName = String.valueOf(System.currentTimeMillis());
    return newFolder(temporaryFolderPath() + tempFileName);
  }

  /**
   * Creates a new file using the given path.
   *
   * @param path the path of the new file.
   * @return the new created file.
   * @throws IORuntimeException if the path belongs to an existing non-empty directory.
   * @throws IORuntimeException if the path belongs to an existing file.
   * @throws IORuntimeException if any I/O error is thrown when creating the new file.
   */
  public static @NotNull File newFile(@NotNull String path) {
    File file = new File(path);
// Path: src/main/java/org/fest/util/Arrays.java
// public static <T> boolean isNullOrEmpty(@Nullable T[] array) {
//   return array == null || !hasElements(array);
// }
// 
// Path: src/main/java/org/fest/util/Closeables.java
// public static void closeQuietly(@NotNull Closeable... closeables) {
//   for (Closeable c : closeables) {
//     close(c);
//   }
// }
// 
// Path: src/main/java/org/fest/util/Flushables.java
// public static void flushQuietly(@NotNull Flushable... flushables) {
//   for (Flushable f : flushables) {
//     flush(f);
//   }
// }
// 
// Path: src/main/java/org/fest/util/Preconditions.java
// public static @NotNull <T> T checkNotNull(@Nullable T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }
// 
// Path: src/main/java/org/fest/util/Strings.java
// public static @NotNull StringToAppend append(@NotNull String toAppend) {
//   return new StringToAppend(toAppend);
// }
// 
// Path: src/main/java/org/fest/util/Strings.java
// public static @Nullable String quote(@Nullable String s) {
//   return s != null ? String.format("'%s'", s) : null;
// }


// Path: src/main/java/org/fest/util/Files.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import static java.io.File.separator;
import static java.lang.String.format;
import static org.fest.util.Arrays.isNullOrEmpty;
import static org.fest.util.Closeables.closeQuietly;
import static org.fest.util.Flushables.flushQuietly;
import static org.fest.util.Preconditions.checkNotNull;
import static org.fest.util.Strings.append;
import static org.fest.util.Strings.quote;

  public static @NotNull File newTemporaryFile() {
    String tempFileName = String.format("%d.%s", System.currentTimeMillis(), ".txt");
    return newFile(temporaryFolderPath() + tempFileName);
  }

  /**
   * Creates a new directory in the system's temporary directory. The name of the directory will be the result of:
   * <p/>
   * <pre>
   * System.currentTimeMillis();
   * </pre>
   *
   * @return the created file.
   */
  public static @NotNull File newTemporaryFolder() {
    String tempFileName = String.valueOf(System.currentTimeMillis());
    return newFolder(temporaryFolderPath() + tempFileName);
  }

  /**
   * Creates a new file using the given path.
   *
   * @param path the path of the new file.
   * @return the new created file.
   * @throws IORuntimeException if the path belongs to an existing non-empty directory.
   * @throws IORuntimeException if the path belongs to an existing file.
   * @throws IORuntimeException if any I/O error is thrown when creating the new file.
   */
  public static @NotNull File newFile(@NotNull String path) {
    File file = new File(path);
    if (file.isDirectory() && !isNullOrEmpty(file.list())) {