Package play.libs
Class Files
java.lang.Object
play.libs.Files
Files utils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char[]Characters that are invalid in Windows OS file names (Unix only forbids '/' character)static final char -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidJust copy a filestatic booleanstatic booleanJust delete a file.static booleandeleteDirectory(File path) Recursively delete a directory.static booleanisSameFile(File a, File b) Indicate if two file refers to the same onestatic StringsanitizeFileName(String fileName) Replace all characters that are invalid in file names on Windows or Unix operating systems withILLEGAL_FILENAME_CHARS_REPLACEcharacter.static StringsanitizeFileName(String fileName, char replacement) Replace all characters that are invalid in file names on Windows or Unix operating systems with passed in character.static voidstatic void
-
Field Details
-
ILLEGAL_FILENAME_CHARS
public static final char[] ILLEGAL_FILENAME_CHARSCharacters that are invalid in Windows OS file names (Unix only forbids '/' character) -
ILLEGAL_FILENAME_CHARS_REPLACE
public static final char ILLEGAL_FILENAME_CHARS_REPLACE- See Also:
-
-
Constructor Details
-
Files
public Files()
-
-
Method Details
-
isSameFile
Indicate if two file refers to the same one- Parameters:
a- First file to compareb- Second file to compare- Returns:
- true is file are the same
-
copy
Just copy a file- Parameters:
from- source of the fileto- destination file
-
delete
Just delete a file. If the file is a directory, it's work.- Parameters:
file- The file to delete- Returns:
- true if and only if the file is successfully deleted; false otherwise
-
deleteDirectory
Recursively delete a directory.- Parameters:
path- Path of the directory- Returns:
- true if and only if the directory is successfully deleted; false otherwise
-
copyDir
-
unzip
-
zip
-
sanitizeFileName
Replace all characters that are invalid in file names on Windows or Unix operating systems withILLEGAL_FILENAME_CHARS_REPLACEcharacter.This method makes sure your file name can successfully be used to write new file to disk. Invalid characters are listed in
ILLEGAL_FILENAME_CHARSarray.- Parameters:
fileName- File name to sanitize- Returns:
- Sanitized file name (new String object) if found invalid characters or same string if not
-
sanitizeFileName
Replace all characters that are invalid in file names on Windows or Unix operating systems with passed in character.This method makes sure your file name can successfully be used to write new file to disk. Invalid characters are listed in
ILLEGAL_FILENAME_CHARSarray.- Parameters:
fileName- File name to sanitizereplacement- character to use as replacement for invalid chars- Returns:
- Sanitized file name (new String object) if found invalid characters or same string if not
-