Package org.apache.commons.vfs.provider
Class UriParser
java.lang.Object
org.apache.commons.vfs.provider.UriParser
Utilities for dealing with URIs. See RFC 2396 for details.
- Version:
- $Revision: 480428 $ $Date: 2005-10-13 21:11:33 +0200 (Do, 13 Okt 2005) $
- Author:
- Adam Murdoch
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendEncoded
(StringBuffer buffer, String unencodedValue, char[] reserved) Encodes and appends a string to a StringBuffer.static void
canonicalizePath
(StringBuffer buffer, int offset, int length, FileNameParser fileNameParser) static void
checkUriEncoding
(String uri) static String
Removes %nn encodings from a string.static void
decode
(StringBuffer buffer, int offset, int length) Removes %nn encodings from a string.static String
Removes %nn encodings from a string.static String[]
static void
encode
(StringBuffer buffer, int offset, int length, char[] reserved) Encodes a set of reserved characters in a StringBuffer, using the URI %nn encoding.static String
static String
Extracts the first element of a path.static String
static String
extractScheme
(String uri) Extracts the scheme from a URI.static String
extractScheme
(String uri, StringBuffer buffer) Extracts the scheme from a URI.static boolean
fixSeparators
(StringBuffer name) Normalises the separators in a name.static FileType
normalisePath
(StringBuffer path) Normalises a path.
-
Field Details
-
TRANS_SEPARATOR
public static final char TRANS_SEPARATORThe set of valid separators. These are all converted to the normalised one. Does not contain the normalised separator- See Also:
-
-
Method Details
-
extractFirstElement
Extracts the first element of a path. -
normalisePath
Normalises a path. Does the following:- Removes empty path elements.
- Handles '.' and '..' elements.
- Removes trailing separator.
- Throws:
FileSystemException
- See Also:
-
fixSeparators
Normalises the separators in a name. -
extractScheme
Extracts the scheme from a URI.- Parameters:
uri
- The URI.- Returns:
- The scheme name. Returns null if there is no scheme.
-
extractScheme
Extracts the scheme from a URI. Removes the scheme and ':' delimiter from the front of the URI.- Parameters:
uri
- The URI.buffer
- Returns the remainder of the URI.- Returns:
- The scheme name. Returns null if there is no scheme.
-
decode
Removes %nn encodings from a string.- Throws:
FileSystemException
-
decode
Removes %nn encodings from a string.- Throws:
FileSystemException
-
appendEncoded
Encodes and appends a string to a StringBuffer. -
encode
Encodes a set of reserved characters in a StringBuffer, using the URI %nn encoding. Always encodes % characters. -
encode
Removes %nn encodings from a string. -
encode
-
encode
-
checkUriEncoding
- Throws:
FileSystemException
-
canonicalizePath
public static void canonicalizePath(StringBuffer buffer, int offset, int length, FileNameParser fileNameParser) throws FileSystemException - Throws:
FileSystemException
-
extractQueryString
-