Package snap.util

Class FilePathUtils

java.lang.Object
snap.util.FilePathUtils

public class FilePathUtils extends Object
Utility methods for file path strings.
  • Field Details

    • SEPARATOR

      public static final String SEPARATOR
    • SEPARATOR_CHAR

      public static final char SEPARATOR_CHAR
    • PATH_SEPARATOR

      public static final String PATH_SEPARATOR
    • PATH_SEPARATOR_CHAR

      public static final char PATH_SEPARATOR_CHAR
  • Constructor Details

    • FilePathUtils

      public FilePathUtils()
  • Method Details

    • getNormalizedPath

      public static String getNormalizedPath(String aPath)
      Returns the path in standard unix format (forward slash separator with leading slash and no trailing slash).
    • getFilename

      public static String getFilename(String aPath)
      Returns the file name component of the given string path (everything after last file separator).
    • getFilenameSimple

      public static String getFilenameSimple(String aPath)
      Returns the simple file name for a given path (just the file name without extension).
    • getExtension

      public static String getExtension(String aPath)
      Returns the extension of the given string path (everything after last '.').
    • getFileType

      public static String getFileType(String aPath)
      Returns the file type of the given string path (everything after last '.' in lowercase).
    • getPathWithoutExtension

      public static String getPathWithoutExtension(String aPath)
      Returns the given string path minus any extension.
    • getParentPath

      public static String getParentPath(String aPath)
      Returns the given string path minus the file name component (everything after last file separator).
    • getChildPath

      public static String getChildPath(String aPath, String aChildPath)
      Returns a path with a filename or relative path added.
    • getPeerPath

      public static String getPeerPath(String aPath, String aName)
      Returns a peer path for given path and new filename by stripping filename from given path and using given name.
    • getSisterPath

      public static String getSisterPath(String aPath, String anExtension)
      Returns a sister path for given path and new extension by stripping extension from path and using given extension.
    • getNativePath

      public static String getNativePath(String aPath)
      Returns a native path for given absolute path using platform native File separator char.
    • getNativePaths

      public static String[] getNativePaths(String[] thePaths)
      Returns the native paths for given absolute paths using platform native File separator char.
    • getJoinedPath

      public static String getJoinedPath(String[] thePaths)
      Returns the total string when joining the given paths by the platform path separator.
    • getUrlForPath

      public static URL getUrlForPath(String aPath)
      Returns a URL for given path.
    • getUrlsForPaths

      public static URL[] getUrlsForPaths(String[] thePaths)
      Returns the URLs for given paths.