Class FileHelper

java.lang.Object
de.ipk_gatersleben.ag_nw.graffiti.FileHelper
All Implemented Interfaces:
HelperClass

public class FileHelper
extends Object
implements HelperClass
Created on 13/05/2004 Extended on 14/08/2015
Author:
Tobias Czauderna
  • Constructor Details

    • FileHelper

      public FileHelper()
  • Method Details

    • getFileName

      public static String getFileName​(String defaultExt, String description, String defaultFileName)
    • getFileName

      public static String getFileName​(String defaultExt, String description)
    • deleteDirRecursively

      public static void deleteDirRecursively​(File f)
      Recursively deletes a directory
      Parameters:
      path - the path of the directory to be deleted
    • copyFileFromJar

      public static void copyFileFromJar​(URI uri, String sourceFolder, String targetFolder, String fileName)
      Copy file from jar to file system.
      Parameters:
      uri - URI for the jar file
      sourceFolder - folder within the jar file
      targetFolder - folder on the file system to copy the file to
      fileName - file to copy
    • copyFilesFromJar

      public static void copyFilesFromJar​(URI uri, String sourceFolder, String targetFolder, String[] fileNames)
      Copy files from jar to file system.
      Parameters:
      uri - URI for the jar file
      sourceFolder - folder within the jar file
      targetFolder - folder on the file system to copy the files to
      fileNames - files to copy
    • copyFileFromStream

      public static void copyFileFromStream​(String sourceFolder, String targetFolder, String fileName)
      Copy file from resource (as stream) to file system.
      Parameters:
      sourceFolder - folder on the resource to copy the files from
      targetFolder - folder on the file system to copy the files to
      fileName - file to copy
    • copyFile

      public static void copyFile​(String sourceFolder, String targetFolder, String fileName)
      Copy file from a folder on the file system to another folder on the file system.
      Parameters:
      sourceFolder - folder on the file system to copy the file from
      targetFolder - folder on the file system to copy the file to
      fileName - file to copy
    • copyFiles

      public static void copyFiles​(String sourceFolder, String targetFolder, String[] fileNames)
      Copy files from a folder on the file system to another folder on the file system.
      Parameters:
      sourceFolder - folder on the file system to copy the files from
      targetFolder - folder on the file system to copy the files to
      fileNames - files to copy
    • downloadFile

      public static boolean downloadFile​(URL urlFile, String destPath, String localFilename) throws IOException
      Downloads a file from the web to a local folder.
      Parameters:
      urlFile -
      destPath -
      localFilename -
      Returns:
      Throws:
      IOException