Esempio n. 1
0
 /**
  * Each {@link FileDetails} is known by its canonical file name, which is also the format used for
  * Ant path matching etc. This method provides the canonical file name without forcing the user to
  * deal with the exceptions that would arise from using {@link File} directly.
  *
  * @return the canonical path.
  */
 public String getCanonicalPath() {
   return FileUtils.getCanonicalPath(file);
 }
Esempio n. 2
0
 /**
  * Indicates whether the given canonical path matches the given Ant-style pattern
  *
  * @param antPattern the pattern to check against (can't be blank)
  * @param canonicalPath the path to check (can't be blank)
  * @return see above
  * @deprecated use {@link FileUtils#matchesAntPath(String, String)} instead
  */
 @Deprecated
 public static boolean matchesAntPath(final String antPattern, final String canonicalPath) {
   return FileUtils.matchesAntPath(antPattern, canonicalPath);
 }
Esempio n. 3
0
 /**
  * Indicates whether this file's canonical path matches the given Ant-style pattern.
  *
  * <p>The presented path must be in Ant syntax. It should include a full prefix that is consistent
  * with the {@link #getCanonicalPath()} method.
  *
  * @param antPattern the pattern to check this file against (cannot be blank)
  * @return whether the path matches or not
  */
 public boolean matchesAntPath(final String antPattern) {
   return FileUtils.matchesAntPath(antPattern, getCanonicalPath());
 }
Esempio n. 4
0
 /**
  * Returns the canonical path of the given {@link File}.
  *
  * @param file the file for which to find the canonical path (required)
  * @return the canonical path
  * @deprecated use {@link FileUtils#getCanonicalPath(File)} instead
  */
 @Deprecated
 public static String getCanonicalPath(final File file) {
   return FileUtils.getCanonicalPath(file);
 }
Esempio n. 5
0
 /**
  * Indicates whether the presented canonical path is a child of the current {@link FileDetails}
  * instance. Put differently, returning true indicates the current instance is a parent directory
  * of the presented possibleChildCanonicalPath.
  *
  * <p>This method will return true if the presented child is a child of the current instance, or
  * if the presented child is identical to the current instance.
  *
  * @param possibleChildCanonicalPath to evaluate (required)
  * @return true if the presented possible child is indeed a child of the current instance
  */
 public boolean isParentOf(final String possibleChildCanonicalPath) {
   Validate.notBlank(possibleChildCanonicalPath, "Possible child to evaluate is required");
   return FileUtils.ensureTrailingSeparator(possibleChildCanonicalPath)
       .startsWith(FileUtils.ensureTrailingSeparator(getCanonicalPath()));
 }