Class FileUtil
java.lang.Object
org.ampere.base.util.FileUtil
- All Implemented Interfaces:
PACTEdef
-
Field Summary
Fields inherited from interface org.ampere.base.util.PACTEdef
AMBIGUOUS, DOUBLE_TAG, FREQUENCY_NAME, FREQUENCY_TAG, TIME_NAME, TIME_TAG, UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Fileadd an index to a file befor the extensionstatic PathbuildAbsolute(Path workingDirectory, String relativePath) Build an absolute path with a relative unix path, as ..static PathbuildAbsolute(Path dir, String child, String... following) Build an absolute path to a brother file having path, as ..static PathbuildAbsolute(Path parent, List<String> list) static FilebuildAndCreateDirectory(File parent, String dirName) Build or Create a subdirectorystatic FileInputStreambuildFileInputStream(File file) static FileReaderbuildFileReader(File file) static Filebuild a file from an absolute or a relative path with true system path validation.static FilebuildOrCreateDirectory(File wdir, String relativePath2dir) Build or create the associated directorystatic PrintWriterbuildWriter(File file) static FilechangeExtension(File file, String extension) Validate a file to have a given extension.static FilecompleteName(File file, String complement) Build a new File by completing the name without changing its extention.static StringgetExtension(String path) Remove a posible extension to a pathstatic FileGet the file of the array matching the input namestatic Integerstatic FilegetOrCreate(Path dirp) static booleanhasExtension(File file, String extension) Test if a file has a given extension or notstatic Filestatic voidprintFullFileName(PrintWriter out, File file) static voidrename in a same directorystatic FilevalidateExtension(File file, String extension) Validate a file to have a given extension.static FilewithoutExtension(File file) static StringwithoutExtension(String path) Remove a posible extension to a path
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
buildAndCreateDirectory
-
getOrCreate
-
addIndex
-
getIndex
-
increment
-
buildAbsolute
Build an absolute path with a relative unix path, as ../somepath Notice that tha parameter workingDirectory is not necessarily the current working directory of the user.- Parameters:
workingDirectory- considered working directory, i.e. a brother file of the return one.relativePath- input relative path that must start by ../- Returns:
- the built absolute path.
-
buildAbsolute
Build an absolute path to a brother file having path, as ../somepath Notice that tha parameter workingDirectory is not necessarily the current working directory of the user.- Parameters:
dir- considered working directory, i.e. a brother file of the return one.- Returns:
- the built absolute path.
-
buildOrCreateDirectory
-
buildAbsolute
-
validateExtension
-
changeExtension
-
rename
-
getFile
-
buildWriter
-
withoutExtension
-
getExtension
-
withoutExtension
-
hasExtension
-
completeName
-
printFullFileName
-
buildFrom
-
buildFileReader
-
buildFileInputStream
-