Package org.apache.commons.vfs2.provider
Class GenericFileName
- java.lang.Object
-
- org.apache.commons.vfs2.provider.AbstractFileName
-
- org.apache.commons.vfs2.provider.GenericFileName
-
- Direct Known Subclasses:
URLFileName
public class GenericFileName extends AbstractFileName
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
-
Fields inherited from interface org.apache.commons.vfs2.FileName
ROOT_PATH, SEPARATOR, SEPARATOR_CHAR
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GenericFileName(java.lang.String scheme, java.lang.String hostName, int port, int defaultPort, java.lang.String userName, java.lang.String password, java.lang.String path, FileType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendCredentials(java.lang.StringBuilder buffer, boolean addPassword)
Append the user credentials.protected void
appendRootUri(java.lang.StringBuilder buffer, boolean addPassword)
Builds the root URI for this file name.FileName
createName(java.lang.String absPath, FileType type)
Create a FileName.int
getDefaultPort()
Returns the default port for this file name.java.lang.String
getHostName()
Returns the host name part of this name.java.lang.String
getPassword()
Returns the password part of this name.int
getPort()
Returns the port part of this name.java.lang.String
getUserName()
Returns the user name part of this name.-
Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileName
checkName, compareTo, createURI, equals, getBaseName, getDepth, getExtension, getFriendlyURI, getParent, getPath, getPathDecoded, getRelativeName, getRoot, getRootURI, getScheme, getType, getURI, getUriTrailer, hashCode, isAncestor, isDescendent, isDescendent, isFile, toString
-
-
-
-
Constructor Detail
-
GenericFileName
protected GenericFileName(java.lang.String scheme, java.lang.String hostName, int port, int defaultPort, java.lang.String userName, java.lang.String password, java.lang.String path, FileType type)
-
-
Method Detail
-
getUserName
public java.lang.String getUserName()
Returns the user name part of this name.- Returns:
- The user name.
-
getPassword
public java.lang.String getPassword()
Returns the password part of this name.- Returns:
- The password.
-
getHostName
public java.lang.String getHostName()
Returns the host name part of this name.- Returns:
- The host name.
-
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
public FileName createName(java.lang.String absPath, FileType type)
Create a FileName.- Specified by:
createName
in classAbstractFileName
- Parameters:
absPath
- The absolute path.type
- The FileType.- Returns:
- The created FileName.
-
appendRootUri
protected void appendRootUri(java.lang.StringBuilder buffer, boolean addPassword)
Builds the root URI for this file name.- Specified by:
appendRootUri
in classAbstractFileName
- Parameters:
buffer
- A StringBuilder to use to construct the URI.addPassword
- true if the password should be added, false otherwise.
-
appendCredentials
protected void appendCredentials(java.lang.StringBuilder buffer, boolean addPassword)
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).
-
-