Class FilenameUtils

java.lang.Object
org.forgerock.openig.util.FilenameUtils

public final class FilenameUtils extends Object
Utility class for filename related methods. // @Checkstyle:off LineLength Copied from, "https://gitbox.apache.org/repos/asf?p=commons-io.git;a=blob;f=src/main/java/org/apache/commons/io/FilenameUtils.java;h=55057522b8c8336fcf022d31c1f856386c4a863e;hb=refs/heads/master // @Checkstyle:on LineLength
  • Method Details

    • getName

      public static String getName(String fileName)
      Gets the name minus the path from a full fileName

      This method will handle a file in either Unix or Windows format. The text after the last forward or backslash is returned.

       a/b/c.txt --> c.txt
       a.txt     --> a.txt
       a/b/c     --> c
       a/b/c/    --> ""
       

      The output will be the same irrespective of the machine that the code is running on.

      Parameters:
      fileName - the fileName to query, null returns null
      Returns:
      the name of the file without the path, or an empty string if none exists. Null bytes inside string will be removed