java.lang.Object
jp.ecuacion.lib.core.util.FileUtil
Provides File-related utility methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncleanPathStrWithSlash(String path) Cleans a path string.concatFilePaths(String... paths) Concatenates file paths.booleancontainsWildCard(String path) Returns true if the argument path contains wildcard strings.Obtains filename from a path.getFileSavableName(String origName) Changes argument filename into file-savable name.getFileSizeInMb(Long fileSize) Returns file size in Megabyte.getFileSizeInMbWithUnit(Long fileSize) Returns file size in Megabyte.getParentDirPath(String origPath) Changes the path separator to "/".Returns a list of paths which match the path passed by the argument path with wildcards.booleanChecks if file is locked.booleanisRelativePath(String path) Returns true if the path is relative.
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
getFileSavableName
Changes argument filename into file-savable name. -
concatFilePaths
Concatenates file paths.- Parameters:
paths- paths- Returns:
- the concatenated path
-
cleanPathStrWithSlash
Cleans a path string.Paths like
/path//to\filechange to the clean format like/path/to/file.
Separator is always/even if this method is called in Windows OS.- Parameters:
path- path- Returns:
- the cleaned path
-
isLocked
Checks if file is locked.- Parameters:
path- path, Both absolute and relativve path is acceptable.- Returns:
truewhen file is locked.- Throws:
IOException- IOException
-
containsWildCard
Returns true if the argument path contains wildcard strings. -
getPathListFromPathWithWildcard
Returns a list of paths which match the path passed by the argument path with wildcards."*", "?" are supported, but "**" not supported.
The separator of returning Paths is "/"- Throws:
BizLogicAppException
-
isRelativePath
Returns true if the path is relative.- Parameters:
path- path- Returns:
- true if the path is relative
- Throws:
BizLogicAppException- BizLogicAppException
-
getParentDirPath
Changes the path separator to "/".- Parameters:
origPath- original path- Returns:
- the separator changed path
-
getFileNameFromFilePath
Obtains filename from a path.Both "/" and "\" are treated as the separator.
- Parameters:
path- path- Returns:
- filename
-
getFileSizeInMb
Returns file size in Megabyte.- Parameters:
fileSize- fileSize- Returns:
- the file size in Megabyte
-
getFileSizeInMbWithUnit
Returns file size in Megabyte.- Parameters:
fileSize- fileSize- Returns:
- the file size in Megabyte
-