Class IOUtils

java.lang.Object
edu.berkeley.cs.jqf.fuzz.util.IOUtils

public class IOUtils extends Object
Utility class containing static methods for common I/O operations
Author:
Rohan Padhye
  • Constructor Details

    • IOUtils

      public IOUtils()
  • Method Details

    • resolveInputFileOrDirectory

      public static File[] resolveInputFileOrDirectory(File file) throws FileNotFoundException
      Resolves an input file or a directory of files. This is useful for operations like providing seed inputs to a fuzzing engine or repro'ing a corpus of test inputs.
      Parameters:
      file - a file or directory
      Returns:
      a listing of files, if `file` is a directory; a list containing only `file`, if it is a regular file; `null` if `file` is also `null`
      Throws:
      FileNotFoundException - if file does not exist
    • createDirectory

      public static File createDirectory(File parent, String name) throws IOException
      Creates a new writable directory in a given parent directory.
      Parameters:
      parent - the parent directory
      name - the name of the new directory to create
      Returns:
      the newly created directory
      Throws:
      IOException - if a writable directory was not created
    • createDirectory

      public static File createDirectory(File newDir) throws IOException
      Creates a new writable directory.
      Parameters:
      newDir - the new directory to create
      Returns:
      the newly created directory (same as `newDir`)
      Throws:
      IOException - if a writable directory was not created