Package gov.nasa.arc.pds.tools.util
Class FileUtils
- java.lang.Object
-
- gov.nasa.arc.pds.tools.util.FileUtils
-
public class FileUtils extends Object
A helper class for File related functionality.- Version:
- $Revision: $
- Author:
- jagander
-
-
Field Summary
Fields Modifier and Type Field Description static longONE_GBThe number of bytes in a gigabyte.static longONE_KBThe number of bytes in a kilobyte.static longONE_MBThe number of bytes in a megabyte.static StringOPPOSITE_SEP_CHARstatic StringREGEX_SAFE_SEP
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(Closeable closeMe, boolean reThrowExceptions)static booleancontainsFile(File sourceFile, String searchName)static voiddeleteChildren(File file)static booleanempty(File directory)static booleanexists(File file)static booleanforceDeleteAll(File file)static StringfromVaxPath(String vaxPath)static FilegetAlternateCaseFile(File rootFile, String searchName)static FilegetBaseFile(File file)static StringgetBaseName(File file)static FilegetCaseUnknownFile(File rootFile, String searchName)static StringgetContents(File file)static StringgetExtension(File file)static StringgetExtension(String name)static Map<Integer,File>getFileMap(File sourceFile)static Map<Integer,File>getFileMap(File sourceFile, String searchPattern)static Map<Integer,File>getFileMap(File sourceFile, String regex, boolean recursive)static Map<Integer,File>getFileMap(Map<Integer,File> sourceList, String regex)static Map<Integer,File>getFileMapByPattern(File sourceFile, Pattern searchPattern, boolean recursive, boolean excludeSourceControlFiles)static List<File>getFiles(File sourceFile)static List<File>getFiles(File sourceFile, String searchPattern)static List<File>getFiles(File sourceFile, String regex, boolean recursive)static List<File>getFiles(List<File> sourceList, String regex)static List<File>getFilesByPattern(File sourceFile, Pattern searchPattern, boolean recursive)static StringgetRegexSeparator()static StringgetRelativePath(File baseDirectory, File targetFile)static StringgetRelativePath(String basePath, String fullPath)static StringgetRelativePath(URL baseDirectory, URL targetFile)static StringgetSafeName(String string)static FilegetSibling(String fileName, File knownFile)static FilegetTopFileByPattern(File sourceFile, String regex, Integer maxDepth)static FilegetTopFileByPattern(File sourceFile, Pattern searchPattern, Integer maxDepth)static FilegetValidParent(File missingFile)static booleanhasParent(List<File> parents, File searchFile)static booleanisParent(FileMirror parent, FileMirror searchFile)static booleanisParent(File parent, File searchFile)static booleanisSourceControl(File file)static PropertiesloadProperties(File file)static PropertiesloadProperties(Properties props, File file)
-
-
-
Field Detail
-
ONE_KB
public static final long ONE_KB
The number of bytes in a kilobyte.- See Also:
- Constant Field Values
-
ONE_MB
public static final long ONE_MB
The number of bytes in a megabyte.- See Also:
- Constant Field Values
-
ONE_GB
public static final long ONE_GB
The number of bytes in a gigabyte.- See Also:
- Constant Field Values
-
OPPOSITE_SEP_CHAR
public static final String OPPOSITE_SEP_CHAR
-
REGEX_SAFE_SEP
public static final String REGEX_SAFE_SEP
-
-
Method Detail
-
getFilesByPattern
public static List<File> getFilesByPattern(File sourceFile, Pattern searchPattern, boolean recursive)
-
getTopFileByPattern
public static File getTopFileByPattern(File sourceFile, String regex, Integer maxDepth)
-
getTopFileByPattern
public static File getTopFileByPattern(File sourceFile, Pattern searchPattern, Integer maxDepth)
-
getFileMap
public static Map<Integer,File> getFileMap(File sourceFile, String regex, boolean recursive)
-
getFileMapByPattern
public static Map<Integer,File> getFileMapByPattern(File sourceFile, Pattern searchPattern, boolean recursive, boolean excludeSourceControlFiles)
-
getFileMap
public static Map<Integer,File> getFileMap(Map<Integer,File> sourceList, String regex)
-
getContents
public static String getContents(File file) throws IOException
- Throws:
IOException
-
isParent
public static boolean isParent(FileMirror parent, FileMirror searchFile)
-
getRegexSeparator
public static String getRegexSeparator()
-
exists
public static boolean exists(File file)
-
loadProperties
public static Properties loadProperties(File file)
-
loadProperties
public static Properties loadProperties(Properties props, File file)
-
close
public static void close(Closeable closeMe, boolean reThrowExceptions)
-
deleteChildren
public static void deleteChildren(File file)
-
forceDeleteAll
public static boolean forceDeleteAll(File file)
-
empty
public static boolean empty(File directory)
-
isSourceControl
public static boolean isSourceControl(File file)
-
-