Class FileManagementUtil

java.lang.Object
org.wso2.maven.p2.generate.utils.FileManagementUtil

public class FileManagementUtil extends Object
  • Constructor Details

    • FileManagementUtil

      public FileManagementUtil()
  • Method Details

    • getProfileConfigIniFile

      public static File getProfileConfigIniFile(String destination, String profile)
      Parameters:
      destination -
      profile -
      Returns:
      the config.ini file for the Profile
    • changeConfigIniProperty

      public static void changeConfigIniProperty(File configIniFile, String propKey, String value)
    • copyDirectory

      public static void copyDirectory(File srcPath, File dstPath, List filesToBeCopied) throws IOException
      Throws:
      IOException
    • getAllFilesPresentInFolder

      public static List getAllFilesPresentInFolder(File srcPath)
    • removeEmptyDirectories

      public static void removeEmptyDirectories(File srcPath)
    • zipFolder

      public static void zipFolder(String srcFolder, String destZipFile)
    • copyFile

      public static void copyFile(String src, String dest)
    • createFileAndParentDirectories

      public static File createFileAndParentDirectories(String fileName) throws Exception
      Throws:
      Exception
    • deleteDir

      public static boolean deleteDir(File dir)
    • deleteDirectories

      public static void deleteDirectories(File dir)
    • deleteDirectories

      public static void deleteDirectories(String dir)
    • createTargetFile

      public static void createTargetFile(String sourceFileName, String targetFileName) throws Exception
      Throws:
      Exception
    • createTargetFile

      public static void createTargetFile(String sourceFileName, String targetFileName, boolean overwrite) throws Exception
      Throws:
      Exception
    • createDirectory

      public static boolean createDirectory(String directory)
    • createDirectorys

      public static boolean createDirectorys(String directory)
    • copyDirectory

      public static void copyDirectory(File srcDir, File dstDir) throws IOException
      Throws:
      IOException
    • copy

      public static void copy(File src, File dst) throws IOException
      Throws:
      IOException
    • addAnotherNodeToPath

      public static String addAnotherNodeToPath(String currentPath, String newNode)
    • addNodesToPath

      public static String addNodesToPath(String currentPath, String[] newNode)
    • addNodesToPath

      public static String addNodesToPath(StringBuffer currentPath, String[] pathNodes)
    • addNodesToURL

      public static String addNodesToURL(String currentPath, String[] newNode)
    • getMatchingFiles

      public static File[] getMatchingFiles(String sourceDir, String fileNamePrefix, String extension)
      Get the list of file with a prefix of fileNamePrefix & an extension of extension
      Parameters:
      sourceDir - The directory in which to search the files
      fileNamePrefix - The prefix to look for
      extension - The extension to look for
      Returns:
      The list of file with a prefix of fileNamePrefix & an extension of extension
    • filterOutRestrictedFiles

      public static void filterOutRestrictedFiles(String sourceDir, String fileNamePrefix, String extension)
      Filter out files inside a sourceDir with matching and extension
      Parameters:
      sourceDir - The directory to filter the files
      fileNamePrefix - The filtering filename prefix
      extension - The filtering file extension
    • unzip

      public static void unzip(File archiveFile, File destination) throws Exception
      Throws:
      Exception