Class HostFileNameParser

    • Field Detail

      • defaultPort

        private final int defaultPort
    • Constructor Detail

      • HostFileNameParser

        public HostFileNameParser​(int defaultPort)
    • Method Detail

      • extractHostName

        protected java.lang.String extractHostName​(java.lang.StringBuilder name)
        Extracts the hostname from a URI.
        Parameters:
        name - string buffer with the "scheme://[userinfo@]" part has been removed already. Will be modified.
        Returns:
        the host name or null.
      • extractPort

        protected int extractPort​(java.lang.StringBuilder name,
                                  java.lang.String uri)
                           throws FileSystemException
        Extracts the port from a URI.
        Parameters:
        name - string buffer with the "scheme://[userinfo@]hostname" part has been removed already. Will be modified.
        uri - full URI for error reporting.
        Returns:
        The port, or -1 if the URI does not contain a port.
        Throws:
        FileSystemException - if URI is malformed.
        java.lang.NumberFormatException - if port number cannot be parsed.
      • extractToPath

        protected HostFileNameParser.Authority extractToPath​(VfsComponentContext context,
                                                             java.lang.String uri,
                                                             java.lang.StringBuilder name)
                                                      throws FileSystemException
        Extracts the scheme, userinfo, hostname and port components of a generic URI.
        Parameters:
        context - component context.
        uri - The absolute URI to parse.
        name - Used to return the remainder of the URI.
        Returns:
        Authority extracted host authority, never null.
        Throws:
        FileSystemException - if authority cannot be extracted.
      • extractUserInfo

        protected java.lang.String extractUserInfo​(java.lang.StringBuilder name)
        Extracts the user info from a URI.
        Parameters:
        name - string buffer with the "scheme://" part has been removed already. Will be modified.
        Returns:
        the user information up to the '@' or null.
      • getDefaultPort

        public int getDefaultPort()
      • parseUri

        public FileName parseUri​(VfsComponentContext context,
                                 FileName base,
                                 java.lang.String fileName)
                          throws FileSystemException
        Description copied from interface: FileNameParser
        Parses a String into a file name.
        Parameters:
        context - The component context.
        base - The base FileName.
        fileName - The target file name.
        Returns:
        A FileName that represents the taret file.
        Throws:
        FileSystemException - if an error occurs parsing the URI.