Class FileTool
java.lang.Object
com.tunyk.mvn.plugins.htmlcompressor.FileTool
The Class FileTool.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetElapsedHMSTime(long elapsedTime) Gets the elapsed HMS time.Gets the file encoding.String[]Gets the file extensions.getFiles()Gets the files.Gets the root dir path.static StringhumanReadableByteCount(long bytes, boolean systemOfUnits) Human readable byte count.booleanChecks if is recursive.voidsetFileEncoding(Charset fileEncoding) Sets the file encoding.voidsetFileExtensions(String[] fileExtensions) Sets the file extensions.voidsetRecursive(boolean recursive) Sets the recursive.voidsetRootDirPath(String rootDirPath) Sets the root dir path.voidwriteFiles(Map<String, String> map, String targetDir) Write files.voidWrite to json file.
-
Field Details
-
rootDirPath
The root dir path. -
fileExtensions
The file extensions. -
recursive
private boolean recursiveThe recursive. -
fileEncoding
The file encoding.
-
-
Constructor Details
-
FileTool
Instantiates a new file tool.- Parameters:
rootDir- the root dirfileExtensions- the file extrecursive- the recursive- Throws:
IOException- Signals that an I/O exception has occurred.
-
-
Method Details
-
getFiles
Gets the files.- Returns:
- the files
- Throws:
IOException- Signals that an I/O exception has occurred.
-
writeFiles
Write files.- Parameters:
map- the maptargetDir- the target dir- Throws:
IOException- Signals that an I/O exception has occurred.
-
writeToJsonFile
public void writeToJsonFile(Map<String, String> map, String targetFile, String integrationCode) throws IOException, org.json.JSONExceptionWrite to json file.- Parameters:
map- the maptargetFile- the target fileintegrationCode- the integration code- Throws:
IOException- Signals that an I/O exception has occurred.org.json.JSONException- the JSON exception
-
humanReadableByteCount
Human readable byte count.- Parameters:
bytes- the bytessystemOfUnits- the systemOfUnits- Returns:
- the string
-
getElapsedHMSTime
Gets the elapsed HMS time.- Parameters:
elapsedTime- the elapsed time- Returns:
- the elapsed HMS time
-
getRootDirPath
Gets the root dir path.- Returns:
- the root dir path
-
setRootDirPath
Sets the root dir path.- Parameters:
rootDirPath- the new root dir path- Throws:
IOException- Signals that an I/O exception has occurred.
-
getFileExtensions
Gets the file extensions.- Returns:
- the file extensions
-
setFileExtensions
Sets the file extensions.- Parameters:
fileExtensions- the new file extensions
-
isRecursive
public boolean isRecursive()Checks if is recursive.- Returns:
- true, if is recursive
-
setRecursive
public void setRecursive(boolean recursive) Sets the recursive.- Parameters:
recursive- the new recursive
-
getFileEncoding
Gets the file encoding.- Returns:
- the file encoding
-
setFileEncoding
Sets the file encoding.- Parameters:
fileEncoding- the new file encoding
-