Skip to content
Snippets Groups Projects
Commit c1d6299a authored by tpylak's avatar tpylak
Browse files

list all files method

SVN: 2128
parent 9dbc2b25
No related branches found
No related tags found
No related merge requests found
......@@ -65,20 +65,20 @@ public final class FileUtilities
* A file filter that accepts all entries.
*/
public static final FileFilter ACCEPT_ALL_FILTER = new FileFilter()
{
public boolean accept(File pathname)
{
return true;
}
};
public boolean accept(File pathname)
{
return true;
}
};
/**
* Copies the content of the specified source file to the specified destination file.
*
* @param sourceFile File to be copied.
* @param destinationFile File to whom content of <code>sourceFile</code> is copied.
* @param preservesLastModifiedDate If <code>true</code> the last modified date of <code>sourceFile</code>
* will be transfered to <code>destinationFile</code>.
* @param preservesLastModifiedDate If <code>true</code> the last modified date of <code>sourceFile</code> will
* be transfered to <code>destinationFile</code>.
* @throws EnvironmentFailureException if a {@link IOException} occured.
*/
public static void copyFileTo(File sourceFile, File destinationFile, boolean preservesLastModifiedDate)
......@@ -94,7 +94,7 @@ public final class FileUtilities
} catch (IOException ex)
{
throw new EnvironmentFailureException("Couldn't copy file '" + sourceFile + "' to '" + destinationFile
+ "'.", ex);
+ "'.", ex);
} finally
{
IOUtils.closeQuietly(inputStream);
......@@ -112,7 +112,6 @@ public final class FileUtilities
}
}
/**
* Loads a text file to a {@link String}.
*
......@@ -138,6 +137,7 @@ public final class FileUtilities
IOUtils.closeQuietly(fileReader);
}
}
/**
* Writes the specified string to the specified file.
*
......@@ -147,7 +147,7 @@ public final class FileUtilities
{
assert file != null : "Unspecified file.";
assert str != null : "Unspecified string.";
FileWriter fileWriter = null;
try
{
......@@ -593,6 +593,19 @@ public final class FileUtilities
}
}
/**
* Lists all resources in a given directory.
*
* @param directory the directory to list
* @param loggerOrNull logger, if <code>null</code> than no logging occurs
* @return all files in <var>directory</var> or <code>null</code>, if <var>directory</var> does not exist or is
* not a directory.
*/
public static File[] tryListFiles(File directory, ISimpleLogger loggerOrNull)
{
return tryListFiles(directory, ACCEPT_ALL_FILTER, loggerOrNull);
}
/**
* Lists all resources in a given directory which match the filter.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment