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 Summary
Constructors Constructor Description FileHelper()
-
Method Summary
Modifier and Type Method Description 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.static void
copyFileFromJar(URI uri, String sourceFolder, String targetFolder, String fileName)
Copy file from jar to file system.static void
copyFileFromStream(String sourceFolder, String targetFolder, String fileName)
Copy file from resource (as stream) to file system.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.static void
copyFilesFromJar(URI uri, String sourceFolder, String targetFolder, String[] fileNames)
Copy files from jar to file system.static void
deleteDirRecursively(File f)
Recursively deletes a directorystatic boolean
downloadFile(URL urlFile, String destPath, String localFilename)
Downloads a file from the web to a local folder.static String
getFileName(String defaultExt, String description)
static String
getFileName(String defaultExt, String description, String defaultFileName)
-
Constructor Details
-
FileHelper
public FileHelper()
-
-
Method Details
-
getFileName
-
getFileName
-
deleteDirRecursively
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 filesourceFolder
- folder within the jar filetargetFolder
- folder on the file system to copy the file tofileName
- 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 filesourceFolder
- folder within the jar filetargetFolder
- folder on the file system to copy the files tofileNames
- files to copy
-
copyFileFromStream
Copy file from resource (as stream) to file system.- Parameters:
sourceFolder
- folder on the resource to copy the files fromtargetFolder
- folder on the file system to copy the files tofileName
- file to copy
-
copyFile
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 fromtargetFolder
- folder on the file system to copy the file tofileName
- file to copy
-
copyFiles
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 fromtargetFolder
- folder on the file system to copy the files tofileNames
- files to copy
-
downloadFile
public static boolean downloadFile(URL urlFile, String destPath, String localFilename) throws IOExceptionDownloads a file from the web to a local folder.- Parameters:
urlFile
-destPath
-localFilename
-- Returns:
- Throws:
IOException
-