Class FileUtil
java.lang.Object
io.wcm.devops.conga.generator.util.FileUtil
Utility methods for file handling.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FileEnsure that directory exists and create it if not.static FileensureFileExists(File file) Ensure that file exists.static StringgetCanonicalPath(FileContext fileContext) Deprecated, for removal: This API element is subject to removal in a future version.static StringgetCanonicalPath(File file) Get canoncial path of filestatic StringgetFileInfo(NodeRole nodeRole, RoleFile roleFile) Generates information to identify a file in a role definition by its file name or URL.static StringgetFileInfo(String roleName, RoleFile roleFile) Generates information to identify a file in a role definition by its file name or URL.static StringgetTemplatePath(Role role, RoleFile roleFile) Get template path for a role file.static booleanmatchesExtension(FileContext fileContext, String extension) Checks file extensionstatic booleanmatchesExtension(File file, String extension) Checks file extensionstatic booleanmatchesExtension(String fileExtension, String extension) Checks file extension
-
Method Details
-
getCanonicalPath
Get canoncial path of file- Parameters:
file- File- Returns:
- Canonical path
-
getCanonicalPath
Deprecated, for removal: This API element is subject to removal in a future version.useFileContext.getCanonicalPath()instead.Get canoncial path of file- Parameters:
fileContext- File context- Returns:
- Canonical path
-
ensureFileExists
Ensure that file exists.- Parameters:
file- File- Returns:
- File
-
ensureDirExistsAutocreate
Ensure that directory exists and create it if not.- Parameters:
dir- Directory- Returns:
- Directory
-
matchesExtension
Checks file extension- Parameters:
fileExtension- File extension of file to checkextension- Expected file extension- Returns:
- true if file extension matches
-
matchesExtension
Checks file extension- Parameters:
file- File to checkextension- Expected file extension- Returns:
- true if file extension matches
-
matchesExtension
Checks file extension- Parameters:
fileContext- File context to checkextension- Expected file extension- Returns:
- true if file extension matches
-
getTemplatePath
Get template path for a role file.- Parameters:
role- RoleroleFile- Role file- Returns:
- Path or null if not defined
-
getFileInfo
Generates information to identify a file in a role definition by its file name or URL.- Parameters:
nodeRole- Node roleroleFile- Role file- Returns:
- Info string for role and file
-
getFileInfo
Generates information to identify a file in a role definition by its file name or URL.- Parameters:
roleName- Role nameroleFile- Role file- Returns:
- Info string for role and file
-
FileContext.getCanonicalPath()instead.