java.lang.Object
org.mule.maven.client.internal.util.FileUtils

public class FileUtils extends Object
  • Constructor Details

    • FileUtils

      public FileUtils()
  • Method Details

    • loadFileContentFrom

      public static Optional<byte[]> loadFileContentFrom(URL jarFile) throws IOException
      Loads the content of a file within a jar into a byte array.
      Parameters:
      jarFile - the jar file
      Returns:
      the content of the file as byte array or empty if the file does not exists within the jar file.
      Throws:
      IOException - if there was a problem reading from the jar file.
    • getUrlWithinJar

      public static URL getUrlWithinJar(File jarFile, String filePath) throws MalformedURLException
      Creates an URL to a path within a jar file.
      Parameters:
      jarFile - the jar file
      filePath - the path within the jar file
      Returns:
      an URL to the filePath within the jarFile
      Throws:
      MalformedURLException - if the provided filePath is malformed
    • getUrlsWithinJar

      public static List<URL> getUrlsWithinJar(File file, String directory) throws IOException
      Gets all the URL of files within a directory
      Parameters:
      file - the jar file
      directory - the directory within the jar file
      Returns:
      a collection of URLs to files within the directory directory. Empty collection if the directory does not exists or is empty.
      Throws:
      IOException