Class Utils
java.lang.Object
com.opswat.jenkins.plugins.metadefender.Utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateFileList(String source, String exclude, String workspacePath) Create a file list to scanstatic StringcreateScanResultLink(String scanURL, String dataID) Build a link to view scan resultstatic StringinputStreamtoString(InputStream input) Convert InputStream to Stringstatic voidlistFilesRecursively(String sourcePath, ArrayList<File> output, String[] exclude) List file recursivelystatic voidremoveDuplicateFileInList(ArrayList<File> input) Remove duplicate files in a liststatic voidwriteLogFile(String filePath, String content, boolean isAppend, boolean isLog) Create log file
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
listFilesRecursively
public static void listFilesRecursively(String sourcePath, ArrayList<File> output, String[] exclude) List file recursively- Parameters:
sourcePath- the source file path, can be a file or folderoutput- list of files inside sourcePathexclude- exclude files/folders in this list
-
removeDuplicateFileInList
Remove duplicate files in a list- Parameters:
input- input list
-
createScanResultLink
Build a link to view scan result- Parameters:
scanURL- the source file path, can be a file or folderdataID- list of files inside sourcePath- Returns:
- a full link to view scan result
-
inputStreamtoString
Convert InputStream to String- Parameters:
input- input stream- Returns:
- output string
- Throws:
IOException- in some circumstance
-
createFileList
Create a file list to scan- Parameters:
source- the source file path, can be a file or folderexclude- exclude files/folders from this listworkspacePath- work space path to combine- Returns:
- array list file
-
writeLogFile
Create log file- Parameters:
filePath- log file pathisAppend- append or newisLog- if false, don't log
-