Class UriParser

java.lang.Object
org.apache.commons.vfs.provider.UriParser

public final class UriParser extends Object
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 Details

    • TRANS_SEPARATOR

      public static final char TRANS_SEPARATOR
      The set of valid separators. These are all converted to the normalised one. Does not contain the normalised separator
      See Also:
  • Method Details

    • extractFirstElement

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

      public static FileType normalisePath(StringBuffer path) throws FileSystemException
      Normalises a path. Does the following:
      • Removes empty path elements.
      • Handles '.' and '..' elements.
      • Removes trailing separator.
      Its assumed that the separators are already fixed.
      Throws:
      FileSystemException
      See Also:
    • 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)