Package ucar.nc2.util

Class EscapeStrings


  • public class EscapeStrings
    extends Object
    • Constructor Detail

      • EscapeStrings

        public EscapeStrings()
    • Method Detail

      • unescapeDAPIdentifier

        public static String unescapeDAPIdentifier​(String id)
        Define the DEFINITIVE opendap identifier unescape function.
        Parameters:
        id - The identifier to unescape.
        Returns:
        The unescaped identifier.
      • escapeURLQuery

        public static String escapeURLQuery​(String ce)
        Define the DEFINITIVE URL constraint expression escape function.
        Parameters:
        ce - The expression to modify.
        Returns:
        The escaped expression.
      • unescapeURLQuery

        public static String unescapeURLQuery​(String ce)
        Define the DEFINITIVE URL constraint expression unescape function.
        Parameters:
        ce - The expression to unescape.
        Returns:
        The unescaped expression.
      • urlDecode

        public static String urlDecode​(String s)
        Define the DEFINITIVE URL unescape function.
        Parameters:
        s - The string to unescape.
        Returns:
        The unescaped expression.
      • unescapeURL

        public static String unescapeURL​(String url)
        Decode all of the parts of the url including query and fragment
        Parameters:
        url - the url to encode
      • escapeDAPIdentifier

        public static String escapeDAPIdentifier​(String s)
        Define the DAP escape identifier function.
        Parameters:
        s - The string to encode.
        Returns:
        The escaped string.
      • escapeOGC

        public static String escapeOGC​(String s)
        Define the OGC Web Services escape function.
        Parameters:
        s - The string to encode.
        Returns:
        The escaped string.
      • testOGC

        public static void testOGC()
      • backslashEscape

        public static String backslashEscape​(String x,
                                             String reservedChars)
        backslash escape a string
        Parameters:
        x - escape this; may be null
        reservedChars - these chars get a backslash in front of them
        Returns:
        escaped string
      • backslashUnescape

        public static String backslashUnescape​(String x)
        backslash unescape a string
        Parameters:
        x - unescape this
        Returns:
        string with \c -> c
      • tokenizeEscapedName

        public static List<String> tokenizeEscapedName​(String escapedName)
        Tokenize an escaped name using "." as delimiter, skipping "\."
        Parameters:
        escapedName - an escaped name
        Returns:
        list of tokens
      • indexOf

        public static int indexOf​(String escapedName,
                                  char c)
        Find first occurence of char c in escapedName, excluding escaped c.
        Parameters:
        escapedName - search in this string
        c - for this char but not \\cha
        Returns:
        pos in string, or -1
      • backslashToDAP

        public static String backslashToDAP​(String bs)
        Given a backslash escaped name, convert to a DAP escaped name
        Parameters:
        bs - the string to DAP encode; may have backslash escapes
        Returns:
        escaped string
      • backslashEscapeDapString

        public static String backslashEscapeDapString​(String s)
        Given a DAP (attribute) string, insert backslashes before '"' and '/' characters. This code also escapes control characters, although the spec does not call for it; make that code conditional.
      • backslashEscapeCDMString

        public static String backslashEscapeCDMString​(String s,
                                                      String toescape)
        Given a CDM string, insert backslashes before characters.