public final class FileUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEqual(File file1,
File file2)
Compares the contents of two files.
|
static boolean |
areEqual(File file1,
File file2,
org.eclipse.core.runtime.IProgressMonitor monitor)
Compares the contents of two files.
|
static void |
copyDirectory(File source,
File destination)
Copy a directory from source to target including its contained files and directories.
|
static void |
copyFile(File source,
File destination)
This method copies a single file.
|
static void |
copyFile(InputStream source,
File destination)
This method copies a single file and closes the given stream.
|
static String |
createLocationForTemporaryChangePackage()
Creates a temporary file location and returns the absolute path to it.
|
static void |
deleteDirectory(File file,
boolean force)
Deletes a directory.
|
static String |
getExtension(File file)
Returns the extension of the given file.
|
static void |
moveAndOverwrite(File source,
File destination)
Moves the given
source File to the given destination. |
static void |
zipFolder(File source,
File destination)
This method allows you to zip a folder.
|
public static void copyFile(File source, File destination) throws IOException
source - the sourcedestination - the destinationIOException - copy problempublic static void copyFile(InputStream source, File destination) throws IOException
source - the source input streamdestination - the destinationIOException - copy problempublic static void copyDirectory(File source, File destination) throws IOException
source - directorydestination - directoryIOException - on a IO problem during copypublic static void zipFolder(File source, File destination) throws IOException
source - folder to zipdestination - target zip fileIOException - in case of failurepublic static boolean areEqual(File file1, File file2)
file1 - the first filefile2 - the second filepublic static boolean areEqual(File file1, File file2, org.eclipse.core.runtime.IProgressMonitor monitor)
file1 - the first filefile2 - the second filemonitor - a progress monitor that may be used to indicate the progress of the equality checkpublic static void deleteDirectory(File file, boolean force) throws IOException
file - the directoryforce - true if delete should try to delete forcefully including retries, this may be slow.IOException - if delete failspublic static String getExtension(File file)
file - the file whose extension should be determinedpublic static void moveAndOverwrite(File source, File destination) throws IOException
source File to the given destination.source - the source File being moveddestination - the destination the source file should be moved toIOException - in case the move failspublic static String createLocationForTemporaryChangePackage()
.eoc.Copyright © 2017. All rights reserved.