Class UrlFileNameParser
java.lang.Object
org.apache.commons.vfs2.provider.AbstractFileNameParser
org.apache.commons.vfs2.provider.url.UrlFileNameParser
- All Implemented Interfaces:
- FileNameParser
Implementation for any java.net.url based file system.
 
Composite of URLFilenameParser and GenericFilenameParser
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected intcountSlashes(String fileName) This method counts the slashes after the scheme.booleanencodeCharacter(char ch) Check if a character needs encoding (%nn).protected booleanisUrlBased(FileName base, String fileName) Guess if the given file name is a URL with host or not.parseUri(VfsComponentContext context, FileName base, String uri) Parse a URI.
- 
Constructor Details- 
UrlFileNameParserpublic UrlFileNameParser()Constructs a new instance.
 
- 
- 
Method Details- 
countSlashesThis method counts the slashes after the scheme.- Parameters:
- fileName- The file name.
- Returns:
- number of slashes
 
- 
encodeCharacterDescription copied from interface:FileNameParserCheck if a character needs encoding (%nn).- Specified by:
- encodeCharacterin interface- FileNameParser
- Overrides:
- encodeCharacterin class- AbstractFileNameParser
- Parameters:
- ch- the character
- Returns:
- true if character should be encoded
 
- 
isUrlBasedGuess if the given file name is a URL with host or not.VFS treats such URLs differently. A file name is URL-based if the base is a URLFileNameor there are only 2 slashes after the scheme. e.g:http://host/path,file:/path/to/file,file:///path/to/file.- Parameters:
- base- The file name is relative to this base.
- fileName- The file name.
- Returns:
- true if file name contains two slashes or base was URLFileName.
 
- 
parseUripublic FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException Parse a URI.- Parameters:
- context- The component context.
- base- The base FileName.
- uri- The target file name.
- Returns:
- The FileName.
- Throws:
- FileSystemException- if an error occurs
 
 
-