org.apache.commons.vfs.provider
Class GenericFileName

java.lang.Object
  extended by org.apache.commons.vfs.provider.AbstractFileName
      extended by org.apache.commons.vfs.provider.GenericFileName
All Implemented Interfaces:
java.lang.Comparable, FileName
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.

Version:
$Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
Author:
Adam Murdoch

Field Summary
private  int defaultPort
           
private  java.lang.String hostName
           
private  java.lang.String password
           
private static char[] PASSWORD_RESERVED
           
private  int port
           
private  java.lang.String userName
           
private static char[] USERNAME_RESERVED
           
 
Fields inherited from interface org.apache.commons.vfs.FileName
ROOT_PATH, SEPARATOR, SEPARATOR_CHAR
 
Constructor Summary
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
protected  void appendCredentials(java.lang.StringBuffer buffer, boolean addPassword)
          append the user credentials
protected  void appendRootUri(java.lang.StringBuffer buffer, boolean addPassword)
          Builds the root URI for this file name.
 FileName createName(java.lang.String absPath, FileType type)
          Factory method for creating name instances.
 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.vfs.provider.AbstractFileName
checkName, compareTo, createURI, equals, getBaseName, getDepth, getExtension, getFriendlyURI, getParent, getPath, getPathDecoded, getRelativeName, getRoot, getRootURI, getScheme, getType, getURI, getUriTrailer, hashCode, isAncestor, isDescendent, isDescendent, setType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

userName

private final java.lang.String userName

hostName

private final java.lang.String hostName

defaultPort

private final int defaultPort

password

private final java.lang.String password

port

private final int port

USERNAME_RESERVED

private static final char[] USERNAME_RESERVED

PASSWORD_RESERVED

private static final char[] PASSWORD_RESERVED
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.


getPassword

public java.lang.String getPassword()
Returns the password part of this name.


getHostName

public java.lang.String getHostName()
Returns the host name part of this name.


getPort

public int getPort()
Returns the port part of this name.


getDefaultPort

public int getDefaultPort()
Returns the default port for this file name.


createName

public FileName createName(java.lang.String absPath,
                           FileType type)
Description copied from class: AbstractFileName
Factory method for creating name instances.

Specified by:
createName in class AbstractFileName

appendRootUri

protected void appendRootUri(java.lang.StringBuffer buffer,
                             boolean addPassword)
Builds the root URI for this file name.

Specified by:
appendRootUri in class AbstractFileName

appendCredentials

protected void appendCredentials(java.lang.StringBuffer buffer,
                                 boolean addPassword)
append the user credentials