public class UtilIO
extends java.lang.Object
| Constructor and Description |
|---|
UtilIO() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteRecursive(java.io.File f)
Deletes all the file/directory and all of its children
|
static java.io.File[] |
findMatches(java.io.File directory,
java.lang.String regex)
Looks for file names which match the regex in the directory.
|
static java.io.File |
getFileToBase() |
static java.lang.String |
getGithubURL(java.lang.String pkg,
java.lang.String app) |
static java.lang.String |
getPathToBase()
Steps back until it finds the base BoofCV directory.
|
static java.lang.String |
getSourcePath(java.lang.String pkg,
java.lang.String app)
Constructs the path for a source code file residing in the examples or demonstrations directory
In the case of the file not being in either directory, an empty string is returned
The expected parameters are class.getPackage().getName(), class.getSimpleName()
|
static int |
indexOfSourceStart(java.lang.String code)
Finds the first javadoc OR the start of the class, which ever comes first.
|
static java.util.List<java.lang.String> |
listAll(java.lang.String directory) |
static java.util.List<java.lang.String> |
listByPrefix(java.lang.String directory,
java.lang.String prefix)
Loads a list of files with the specified prefix.
|
static <T> T |
load(java.lang.String fileName) |
static boolean |
loadLibrary(java.lang.String libraryName) |
static void |
loadLibrarySmart(java.lang.String libraryName) |
static java.lang.String |
path(java.lang.String path)
Searches for the root BoofCV directory and returns an absolute path from it.
|
static java.lang.String |
pathExample(java.lang.String path)
Returns an absolute path to the file that is relative to the example directory
|
static java.lang.String |
readAsString(java.io.InputStream stream)
Reads an entire file and converts it into a text string
|
static java.lang.String |
readAsString(java.lang.String path)
Reads an entire file and converts it into a text string
|
static void |
save(java.lang.Object o,
java.lang.String fileName) |
static java.lang.String |
selectFile(boolean exitOnCancel)
Opens up a dialog box asking the user to select a file.
|
public static java.lang.String pathExample(java.lang.String path)
path - File path relative to root directorypublic static java.lang.String path(java.lang.String path)
path - File path relative to root directorypublic static java.io.File getFileToBase()
public static java.lang.String getPathToBase()
public static java.lang.String selectFile(boolean exitOnCancel)
exitOnCancel - If it should quit on cancel or not.public static void loadLibrarySmart(java.lang.String libraryName)
public static boolean loadLibrary(java.lang.String libraryName)
public static void save(java.lang.Object o,
java.lang.String fileName)
public static <T> T load(java.lang.String fileName)
public static void deleteRecursive(java.io.File f)
public static java.lang.String readAsString(java.lang.String path)
public static java.lang.String readAsString(java.io.InputStream stream)
public static java.lang.String getSourcePath(java.lang.String pkg,
java.lang.String app)
pkg - package containing the classapp - simple class namepublic static java.lang.String getGithubURL(java.lang.String pkg,
java.lang.String app)
public static int indexOfSourceStart(java.lang.String code)
public static java.util.List<java.lang.String> listByPrefix(java.lang.String directory,
java.lang.String prefix)
directory - Directory it looks inside ofprefix - Prefix that the file must havepublic static java.util.List<java.lang.String> listAll(java.lang.String directory)
public static java.io.File[] findMatches(java.io.File directory,
java.lang.String regex)
Looks for file names which match the regex in the directory.
Example:
BoofMiscOps.findMatches(new File("/path/to/directory"), ".+jpg");
directory - directoryregex - file name regex