You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/09/15 13:02:35 UTC
svn commit: r1624996 -
/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
Author: jleroux
Date: Mon Sep 15 11:02:35 2014
New Revision: 1624996
URL: http://svn.apache.org/r1624996
Log:
Adds an isFile() method in FileUtil class.
It checks if the specified fileName exists and is a file (not a directory)
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java?rev=1624996&r1=1624995&r2=1624996&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java Mon Sep 15 11:02:35 2014
@@ -38,9 +38,8 @@ import java.util.Set;
import javolution.util.FastList;
import javolution.util.FastSet;
-import org.ofbiz.base.location.ComponentLocationResolver;
-
import org.apache.commons.io.FileUtils;
+import org.ofbiz.base.location.ComponentLocationResolver;
/**
* File Utilities
@@ -294,6 +293,7 @@ public class FileUtil {
}
}
+ @Override
public boolean accept(File dir, String name) {
File file = new File(dir, name);
if (file.getName().startsWith(".")) {
@@ -395,4 +395,20 @@ public class FileUtil {
return false;
}
}
+
+ /**
+ *
+ *
+ * Check if the specified <code>fileName</code> exists and is a file (not a directory)
+ * If the specified file doesn't exist, <code>FALSE</code> returns.
+ *
+ * @param fileName A full path to a file in which the String will be searched.
+ * @return <code>TRUE</code> if the <code>fileName</code> exists and is a file (not a directory)
+ * <code>FALSE</code> otherwise.
+ */
+ public static boolean isFile(String fileName) {
+ File f = new File(fileName);
+ return f.isFile();
+ }
+
}