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) パス文字列中にワイルドカードが含まれるかどうかをチェック.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 "/".wildcardつきfullPathを引数にとり、そのfullPathに当てはまるfullPathのリストを返す.
「*」と「?」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
パス文字列中にワイルドカードが含まれるかどうかをチェック. -
getPathListFromPathWithWildcard
wildcardつきfullPathを引数にとり、そのfullPathに当てはまるfullPathのリストを返す.
「*」と「?」はサポートしているが、サブディレクトリを含めて検索する「**」はサポートしていない
ワイルドカードを扱う場合は、区切り文字が「/」と「\」の2種類があると煩雑なため、「/」に統一して処理を行う- 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
-