Package snap.util
Class FilePathUtils
java.lang.Object
snap.util.FilePathUtils
Utility methods for file path strings.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getChildPath
(String aPath, String aChildPath) Returns a path with a filename or relative path added.static String
getExtension
(String aPath) Returns the extension of the given string path (everything after last '.').static String
getFilename
(String aPath) Returns the file name component of the given string path (everything after last file separator).static String
getFilenameSimple
(String aPath) Returns the simple file name for a given path (just the file name without extension).static String
getFileType
(String aPath) Returns the file type of the given string path (everything after last '.' in lowercase).static String
getJoinedPath
(String[] thePaths) Returns the total string when joining the given paths by the platform path separator.static String
getNativePath
(String aPath) Returns a native path for given absolute path using platform native File separator char.static String[]
getNativePaths
(String[] thePaths) Returns the native paths for given absolute paths using platform native File separator char.static String
getNormalizedPath
(String aPath) Returns the path in standard unix format (forward slash separator with leading slash and no trailing slash).static String
getParentPath
(String aPath) Returns the given string path minus the file name component (everything after last file separator).static String
getPathWithoutExtension
(String aPath) Returns the given string path minus any extension.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.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.static URL
getUrlForPath
(String aPath) Returns a URL for given path.static URL[]
getUrlsForPaths
(String[] thePaths) Returns the URLs for given paths.
-
Field Details
-
SEPARATOR
-
SEPARATOR_CHAR
public static final char SEPARATOR_CHAR -
PATH_SEPARATOR
-
PATH_SEPARATOR_CHAR
public static final char PATH_SEPARATOR_CHAR
-
-
Constructor Details
-
FilePathUtils
public FilePathUtils()
-
-
Method Details
-
getNormalizedPath
Returns the path in standard unix format (forward slash separator with leading slash and no trailing slash). -
getFilename
Returns the file name component of the given string path (everything after last file separator). -
getFilenameSimple
Returns the simple file name for a given path (just the file name without extension). -
getExtension
Returns the extension of the given string path (everything after last '.'). -
getFileType
Returns the file type of the given string path (everything after last '.' in lowercase). -
getPathWithoutExtension
Returns the given string path minus any extension. -
getParentPath
Returns the given string path minus the file name component (everything after last file separator). -
getChildPath
Returns a path with a filename or relative path added. -
getPeerPath
Returns a peer path for given path and new filename by stripping filename from given path and using given name. -
getSisterPath
Returns a sister path for given path and new extension by stripping extension from path and using given extension. -
getNativePath
Returns a native path for given absolute path using platform native File separator char. -
getNativePaths
Returns the native paths for given absolute paths using platform native File separator char. -
getJoinedPath
Returns the total string when joining the given paths by the platform path separator. -
getUrlForPath
Returns a URL for given path. -
getUrlsForPaths
Returns the URLs for given paths.
-