java.lang.Object
com.opswat.jenkins.plugins.metadefender.Utils

public class Utils extends Object
  • 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 folder
      output - list of files inside sourcePath
      exclude - exclude files/folders in this list
    • removeDuplicateFileInList

      public static void removeDuplicateFileInList(ArrayList<File> input)
      Remove duplicate files in a list
      Parameters:
      input - input list
    • createScanResultLink

      public static String createScanResultLink(String scanURL, String dataID)
      Build a link to view scan result
      Parameters:
      scanURL - the source file path, can be a file or folder
      dataID - list of files inside sourcePath
      Returns:
      a full link to view scan result
    • inputStreamtoString

      public static String inputStreamtoString(InputStream input) throws IOException
      Convert InputStream to String
      Parameters:
      input - input stream
      Returns:
      output string
      Throws:
      IOException - in some circumstance
    • createFileList

      public static ArrayList<File> createFileList(String source, String exclude, String workspacePath)
      Create a file list to scan
      Parameters:
      source - the source file path, can be a file or folder
      exclude - exclude files/folders from this list
      workspacePath - work space path to combine
      Returns:
      array list file
    • writeLogFile

      public static void writeLogFile(String filePath, String content, boolean isAppend, boolean isLog)
      Create log file
      Parameters:
      filePath - log file path
      isAppend - append or new
      isLog - if false, don't log