org.apache.commons.vfs.provider
Class UriParser

java.lang.Object
  extended byorg.apache.commons.vfs.provider.UriParser

public final class UriParser
extends Object

Utilities for dealing with URIs. See RFC 2396 for details.

Version:
$Revision: 191323 $ $Date: 2005-06-19 09:25:16 +0200 (Sun, 19 Jun 2005) $
Author:
Adam Murdoch

Field Summary
static char[] separators
          The set of valid separators.
 
Method Summary
static 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 decode(String encodedStr)
          Removes %nn encodings from a string.
static void decode(StringBuffer buffer, int offset, int length)
          Removes %nn encodings from a string.
static String encode(String decodedStr)
          Removes %nn encodings from a string.
static String[] encode(String[] strings)
           
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 encode(String decodedStr, char[] reserved)
           
static String extractFirstElement(StringBuffer name)
          Extracts the first element of a path.
static String extractQueryString(StringBuffer name)
           
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 void normalisePath(StringBuffer path)
          Normalises a path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

separators

public static final char[] separators
The set of valid separators. These are all converted to the normalised one. Does not contain the normalised separator

Method Detail

extractFirstElement

public static String extractFirstElement(StringBuffer name)
Extracts the first element of a path.


normalisePath

public static void normalisePath(StringBuffer path)
                          throws FileSystemException
Normalises a path. Does the following:

Throws:
FileSystemException

fixSeparators

public static boolean fixSeparators(StringBuffer name)
Normalises the separators in a name.


extractScheme

public static String extractScheme(String uri)
Extracts the scheme from a URI.

Parameters:
uri - The URI.
Returns:
The scheme name. Returns null if there is no scheme.

extractScheme

public static String extractScheme(String uri,
                                   StringBuffer buffer)
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

public static String decode(String encodedStr)
                     throws FileSystemException
Removes %nn encodings from a string.

Throws:
FileSystemException

decode

public static void decode(StringBuffer buffer,
                          int offset,
                          int length)
                   throws FileSystemException
Removes %nn encodings from a string.

Throws:
FileSystemException

appendEncoded

public static void appendEncoded(StringBuffer buffer,
                                 String unencodedValue,
                                 char[] reserved)
Encodes and appends a string to a StringBuffer.


encode

public 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. Always encodes % characters.


encode

public static String encode(String decodedStr)
Removes %nn encodings from a string.


encode

public static String encode(String decodedStr,
                            char[] reserved)

encode

public static String[] encode(String[] strings)

checkUriEncoding

public static void checkUriEncoding(String uri)
                             throws FileSystemException
Throws:
FileSystemException

canonicalizePath

public static void canonicalizePath(StringBuffer buffer,
                                    int offset,
                                    int length,
                                    FileNameParser fileNameParser)
                             throws FileSystemException
Throws:
FileSystemException

extractQueryString

public static String extractQueryString(StringBuffer name)


Copyright © 2002-2005 The Apache Software Foundation. All Rights Reserved.