public class HostFileNameParser extends AbstractFileNameParser
Parses the URL into user/password/host/port/path. Does not handle a query string (after ?).
Modifier and Type | Class and Description |
---|---|
protected static class |
HostFileNameParser.Authority
Parsed authority info (scheme, hostname, username/password, port).
|
Constructor and Description |
---|
HostFileNameParser(int defaultPort) |
Modifier and Type | Method and Description |
---|---|
protected String |
extractHostName(StringBuilder name)
Extracts the hostname from a URI.
|
protected int |
extractPort(StringBuilder name,
String uri)
Extracts the port from a URI.
|
protected HostFileNameParser.Authority |
extractToPath(String uri,
StringBuilder name)
Deprecated.
|
protected HostFileNameParser.Authority |
extractToPath(VfsComponentContext context,
String uri,
StringBuilder name)
Extracts the scheme, userinfo, hostname and port components of a generic URI.
|
protected String |
extractUserInfo(StringBuilder name)
Extracts the user info from a URI.
|
int |
getDefaultPort() |
FileName |
parseUri(VfsComponentContext context,
FileName base,
String fileName)
Parses a String into a file name.
|
encodeCharacter
protected String extractHostName(StringBuilder name)
name
- string buffer with the "scheme://[userinfo@]" part has been removed already. Will be modified.protected int extractPort(StringBuilder name, String uri) throws FileSystemException
name
- string buffer with the "scheme://[userinfo@]hostname" part has been removed already. Will be
modified.uri
- full URI for error reporting.FileSystemException
- if URI is malformed.NumberFormatException
- if port number cannot be parsed.@Deprecated protected HostFileNameParser.Authority extractToPath(String uri, StringBuilder name) throws FileSystemException
extractToPath(VfsComponentContext, String, StringBuilder)
.uri
- The absolute URI to parse.name
- Used to return the remainder of the URI.FileSystemException
- if authority cannot be extracted.protected HostFileNameParser.Authority extractToPath(VfsComponentContext context, String uri, StringBuilder name) throws FileSystemException
context
- component context.uri
- The absolute URI to parse.name
- Used to return the remainder of the URI.FileSystemException
- if authority cannot be extracted.protected String extractUserInfo(StringBuilder name)
name
- string buffer with the "scheme://" part has been removed already. Will be modified.public int getDefaultPort()
public FileName parseUri(VfsComponentContext context, FileName base, String fileName) throws FileSystemException
FileNameParser
context
- The component context.base
- The base FileName.fileName
- The target file name.FileSystemException
- if an error occurs parsing the URI.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.