Package edu.berkeley.cs.jqf.fuzz.util
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 Summary
Constructors Constructor Description IOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static File
createDirectory(File newDir)
Creates a new writable directory.static File
createDirectory(File parent, String name)
Creates a new writable directory in a given parent directory.static File[]
resolveInputFileOrDirectory(File file)
Resolves an input file or a directory of files.
-
-
-
Method Detail
-
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
- iffile
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 directoryname
- 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
-
-