Class FileUtilities
java.lang.Object
ml.karmaconfigs.api.common.utils.file.FileUtilities
Karma file utilities
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringclearParents(String fileString)Clear parent files on a file stringstatic voidCreate a filestatic voidcreateWithException(@NotNull File file)Create a file and catch any exceptionstatic booleancreateWithResults(@NotNull File file)Create a file and return if the file could be createdstatic voidDeletes a filestatic voiddestroyWithException(@NotNull File file)Deletes a file and catch any exceptionstatic booleandestroyWithResults(@NotNull File file)Deletes a file and return if the file could be createdstatic String[]findParents(String fileString)Find parent files on a file stringstatic StringgetExtension(@NotNull File file)Get the file extensionstatic StringgetExtension(@NotNull String name)Get the file extensionstatic StringGet the file replacing the %20 ( space char )static StringGet the file pathstatic StringgetFileCompleteType(File file)Get the file complete typestatic StringgetFileType(File file)Get the file typestatic FilegetFixedFile(@NotNull File file)Fix a filestatic StringGet the file namestatic StringgetParentFile(@NotNull File file)Get the filestatic StringgetParentFile(@NotNull File file, char barReplace)Get the parent file replacing %20 ( space char )static StringgetPrettyFile(File file)Get the pretty file pathstatic StringgetPrettyParentFile(@NotNull File file)Get the pretty filestatic FilegetProjectFolder(String delimiter)Get the project folderstatic FilegetProjectFolder(KarmaSource source)Deprecated.static FileGet the project parent folderstatic FilegetSourceFile(KarmaSource source)Get the karma source jar filestatic booleanisKarmaFile(File file)Get if the file is a karma filestatic booleanisValidFile(File file)Get if the file is validstatic booleanisValidFile(String path)Get if the file is a valid filereadAllLines(File file)Read all the file lines
-
Field Details
-
DEBUG
public static boolean DEBUGEnable debug
-
-
Constructor Details
-
FileUtilities
public FileUtilities()
-
-
Method Details
-
create
Create a file- Parameters:
file- the file to create
-
createWithException
Create a file and catch any exception- Parameters:
file- the file to create- Throws:
IOException- any exception
-
createWithResults
Create a file and return if the file could be created- Parameters:
file- the file to create- Returns:
- if the file could be created
-
destroy
Deletes a file- Parameters:
file- the file to delete
-
destroyWithException
Deletes a file and catch any exception- Parameters:
file- the file to delete- Throws:
IOException- any exception
-
destroyWithResults
Deletes a file and return if the file could be created- Parameters:
file- the file to delete- Returns:
- if the file could be created
-
isKarmaFile
Get if the file is a karma file- Parameters:
file- the file- Returns:
- if the file is a karma file
-
isValidFile
Get if the file is valid- Parameters:
file- the file- Returns:
- if the file is a valid file
-
isValidFile
Get if the file is a valid file- Parameters:
path- the file- Returns:
- if the file is a valid file
-
getParentFile
Get the file- Parameters:
file- the file- Returns:
- the file
-
getFile
Get the file path- Parameters:
file- the file path- Returns:
- the file path
-
getPrettyParentFile
Get the pretty file- Parameters:
file- the file- Returns:
- the pretty file
-
getPrettyFile
Get the pretty file path- Parameters:
file- the file- Returns:
- the pretty file path
-
getParentFile
Get the parent file replacing %20 ( space char )- Parameters:
file- the filebarReplace- the %20 replace- Returns:
- the parent file
-
getFile
Get the file replacing the %20 ( space char )- Parameters:
file- the filebarReplace- the %20 replace- Returns:
- the file
-
getExtension
Get the file extension- Parameters:
file- the file- Returns:
- the file extension
-
getExtension
Get the file extension- Parameters:
name- the file name- Returns:
- the file extension
-
findParents
Find parent files on a file string- Parameters:
fileString- the file string- Returns:
- the file string parent directories
-
clearParents
Clear parent files on a file string- Parameters:
fileString- the files string- Returns:
- the file string without parent files
-
getName
Get the file name- Parameters:
file- the file nameextension- include extension- Returns:
- the file name
-
getFileType
Get the file type- Parameters:
file- the file tpy- Returns:
- the file type
-
getFileCompleteType
Get the file complete type- Parameters:
file- the file complete type- Returns:
- the file type
-
readAllLines
Read all the file lines- Parameters:
file- the file- Returns:
- all the file lines
-
getSourceFile
Get the karma source jar file- Parameters:
source- the karma source- Returns:
- the source jar file
-
getFixedFile
Fix a file- Parameters:
file- the file- Returns:
- the fixed file
-
getProjectFolder
Get the project folder- Parameters:
delimiter- the project complete path delimiter- Returns:
- the project folder
-
getProjectParent
Get the project parent folder- Returns:
- the project parent folder
-
getProjectFolder
Deprecated.UseKarmaSource.getDataPath()thenPath.toFile()insteadGet the project folder- Parameters:
source- the source- Returns:
- the project folder
-
KarmaSource.getDataPath()thenPath.toFile()instead