Package io.hawt.util
Class Files
- java.lang.Object
-
- io.hawt.util.Files
-
public class Files extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Files()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertDirectoryExists(java.io.File file)Throws an exception if the given file does not existstatic voidassertExists(java.io.File file)Throws an exception if the given file or directory does not existstatic voidassertFileExists(java.io.File file)Throws an exception if the given file does not existstatic voidcopy(java.io.File source, java.io.File target)Copy the sourceFileto the targetFile.static java.lang.StringgetMimeType(java.io.File file)static java.lang.StringgetRelativePath(java.io.File rootDir, java.io.File file)static byte[]readBytes(java.io.File file)Reads aFileand returns the data as a byte arraystatic intrecursiveDelete(java.io.File file)Recursively deletes the given file whether it's a file or directory returning the number of files deleted
-
-
-
Method Detail
-
copy
public static void copy(java.io.File source, java.io.File target) throws java.io.IOExceptionCopy the sourceFileto the targetFile.- Throws:
java.io.IOException
-
recursiveDelete
public static int recursiveDelete(java.io.File file)
Recursively deletes the given file whether it's a file or directory returning the number of files deleted
-
getRelativePath
public static java.lang.String getRelativePath(java.io.File rootDir, java.io.File file) throws java.io.IOException- Throws:
java.io.IOException
-
readBytes
public static byte[] readBytes(java.io.File file) throws java.io.IOExceptionReads aFileand returns the data as a byte array- Throws:
java.io.IOException
-
getMimeType
public static java.lang.String getMimeType(java.io.File file)
-
assertExists
public static void assertExists(java.io.File file)
Throws an exception if the given file or directory does not exist
-
assertFileExists
public static void assertFileExists(java.io.File file)
Throws an exception if the given file does not exist
-
assertDirectoryExists
public static void assertDirectoryExists(java.io.File file)
Throws an exception if the given file does not exist
-
-