Class UrlFileNameParser
java.lang.Object
org.apache.commons.vfs.provider.AbstractFileNameParser
org.apache.commons.vfs.provider.url.UrlFileNameParser
- All Implemented Interfaces:
FileNameParser
Implementation for any java.net.url based filesystem.
Composite of URLFilenameParser and GenericFilenameParser
Composite of URLFilenameParser and GenericFilenameParser
- Version:
- $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Wed, 29 Nov 2006) $
- Author:
- imario@apache.org
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 is the given filename is a url with host or not.parseUri
(VfsComponentContext context, FileName base, String filename) parses a String into a filename
-
Constructor Details
-
UrlFileNameParser
public UrlFileNameParser()
-
-
Method Details
-
encodeCharacter
public boolean encodeCharacter(char ch) Description copied from interface:FileNameParser
Check if a character needs encoding (%nn)- Specified by:
encodeCharacter
in interfaceFileNameParser
- Overrides:
encodeCharacter
in classAbstractFileNameParser
- Parameters:
ch
- the character- Returns:
- true if character should be encoded
-
parseUri
public FileName parseUri(VfsComponentContext context, FileName base, String filename) throws FileSystemException Description copied from interface:FileNameParser
parses a String into a filename- Throws:
FileSystemException
-
isUrlBased
Guess is the given filename is a url with host or not. VFS treats such urls differently.
A filename is url-based if the base is aURLFileName
or there are only 2 slashes after the scheme.
e.g: http://host/path, file:/path/to/file, file:///path/to/file -
countSlashes
This method counts the slashes after the scheme.- Parameters:
filename
-- Returns:
- nuof slashes
-