|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.file.util.PathUtils
public class PathUtils
This class contains static helper methods that operate on file paths.
| Nested Class Summary | |
|---|---|
static class |
PathUtils.ResolvedDestination
This class represents a destination entered by the user and resolved by resolveDestination(String, com.mucommander.file.AbstractFile)
into an AbstractFile and a destination type. |
| Constructor Summary | |
|---|---|
PathUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
removeLeadingSeparator(java.lang.String path)
Removes any leading separator character (slash or backslash) from the given path and returns the modified path. |
static java.lang.String |
removeLeadingSeparator(java.lang.String path,
java.lang.String separator)
Removes any leading separator character from the given path and returns the modified path. |
static java.lang.String |
removeTrailingSeparator(java.lang.String path)
Removes any trailing separator character (slash or backslash) from the given path and returns the modified path. |
static java.lang.String |
removeTrailingSeparator(java.lang.String path,
java.lang.String separator)
Removes any trailing separator character (slash or backslash) from the given path and returns the modified path. |
static PathUtils.ResolvedDestination |
resolveDestination(java.lang.String destPath,
AbstractFile baseFolder)
Resolves a destination path entered by the user and returns a PathUtils.ResolvedDestination object that
that contains a AbstractFile instance corresponding to the path and a type that describes the kind of
destination that was resolved. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PathUtils()
| Method Detail |
|---|
public static PathUtils.ResolvedDestination resolveDestination(java.lang.String destPath,
AbstractFile baseFolder)
PathUtils.ResolvedDestination object that
that contains a AbstractFile instance corresponding to the path and a type that describes the kind of
destination that was resolved. null is returned if the path is not a valid destination (see below)
or could not be resolved, for example becuase of I/O or authentication error.
The given path may be either absolute or relative to the specified base folder. If the base folder argument is
null and the path is relative, null will always be returned.
The path may contain '.', '..' and '~' tokens which will be left for the corresponding
SchemeParser to canonize.
The path may refer to the following listed destination types. In all cases, the destination's parent folder must
exist, if it doesn't null will always be returned. For example, /non_existing_folder/file
is not a valid destination (provided that '/non_existing_folder' does not exist).
PathUtils.ResolvedDestination.EXISTING_FOLDERPathUtils.ResolvedDestination.EXISTING_FILEPathUtils.ResolvedDestination.NEW_FILE/existing_folder/existing_archive.zip/ refers to the archive as a folder where as
/existing_folder/existing_archive.zip refers to the archive as a regular file.
destPath - the destination path to resolvebaseFolder - the base folder used for relative paths, null to accept only absolute paths
AbstractFile instance corresponding to the path and a type that
describes the kind of destination that was resolvedpublic static java.lang.String removeLeadingSeparator(java.lang.String path)
path - the path to modify
public static java.lang.String removeLeadingSeparator(java.lang.String path,
java.lang.String separator)
path - the path to modifyseparator - the path separator, usually "/" or "\\"
public static java.lang.String removeTrailingSeparator(java.lang.String path)
path - the path to modify
public static java.lang.String removeTrailingSeparator(java.lang.String path,
java.lang.String separator)
path - the path to modifyseparator - the path separator, usually "/" or "\\"
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard