Class GenericFileName
java.lang.Object
org.apache.commons.vfs2.provider.AbstractFileName
org.apache.commons.vfs2.provider.GenericFileName
- All Implemented Interfaces:
Comparable<FileName>, FileName
- Direct Known Subclasses:
GenericURLFileName, URLFileName
A file name that represents a 'generic' URI, as per RFC 2396. Consists of a scheme, userinfo (typically username and
password), hostname, port, and path.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final Stringprivate final Stringprivate static final char[]private final intprivate final Stringprivate static final char[]Fields inherited from interface FileName
EMPTY_ARRAY, ROOT_PATH, SEPARATOR, SEPARATOR_CHAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendCredentials(StringBuilder buffer, boolean addPassword) Append the user credentials.protected voidappendRootUri(StringBuilder buffer, boolean addPassword) Builds the root URI for this file name.createName(String absPath, FileType type) Create a FileName.intReturns the default port for this file name.Returns the host name part of this name.Returns the password part of this name.intgetPort()Returns the port part of this name.Returns the user name part of this name.Methods inherited from class AbstractFileName
checkName, compareTo, createURI, equals, getBaseName, getDepth, getExtension, getFriendlyURI, getParent, getPath, getPathDecoded, getRelativeName, getRoot, getRootURI, getScheme, getType, getURI, getUriTrailer, hashCode, isAncestor, isDescendent, isDescendent, isFile, setType, toString
-
Field Details
-
USERNAME_RESERVED
private static final char[] USERNAME_RESERVED -
PASSWORD_RESERVED
private static final char[] PASSWORD_RESERVED -
userName
-
hostName
-
defaultPort
private final int defaultPort -
password
-
port
private final int port
-
-
Constructor Details
-
GenericFileName
-
-
Method Details
-
getUserName
-
getPassword
-
getHostName
-
getPort
public int getPort()Returns the port part of this name.- Returns:
- The port number.
-
getDefaultPort
public int getDefaultPort()Returns the default port for this file name.- Returns:
- The default port number.
-
createName
Create a FileName.- Specified by:
createNamein classAbstractFileName- Parameters:
absPath- The absolute path.type- The FileType.- Returns:
- The created FileName.
-
appendRootUri
Builds the root URI for this file name.- Specified by:
appendRootUriin classAbstractFileName- Parameters:
buffer- A StringBuilder to use to construct the URI.addPassword- true if the password should be added, false otherwise.
-
appendCredentials
Append the user credentials.If anything was added, it will be '@' terminated.
- Parameters:
buffer- the string buffer to modify.addPassword- flag if password should be added or replaced with placeholder (false).
-