public class UrlFileNameParser extends AbstractFileNameParser
Composite of URLFilenameParser and GenericFilenameParser
Constructor and Description |
---|
UrlFileNameParser() |
Modifier and Type | Method and Description |
---|---|
protected int |
countSlashes(String fileName)
This method counts the slashes after the scheme.
|
boolean |
encodeCharacter(char ch)
Check if a character needs encoding (%nn).
|
protected boolean |
isUrlBased(FileName base,
String fileName)
Guess if the given file name is a URL with host or not.
|
FileName |
parseUri(VfsComponentContext context,
FileName base,
String uri)
Parse a URI.
|
public boolean encodeCharacter(char ch)
FileNameParser
encodeCharacter
in interface FileNameParser
encodeCharacter
in class AbstractFileNameParser
ch
- the characterpublic FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException
context
- The component context.base
- The base FileName.uri
- The target file name.FileSystemException
- if an error occursprotected boolean isUrlBased(FileName base, String fileName)
VFS treats such URLs differently.
A file name is URL-based if the base is a URLFileName
or there are only 2 slashes after the scheme. e.g:
http://host/path
, file:/path/to/file
, file:///path/to/file
.
base
- The file name is relative to this base.fileName
- The file name.protected int countSlashes(String fileName)
fileName
- The file name.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.