Package ucar.nc2.util
Class EscapeStrings
- java.lang.Object
-
- ucar.nc2.util.EscapeStrings
-
public class EscapeStrings extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
_allowableInDAP
protected static String
_allowableInOGC
protected static String
_allowableInUrl
protected static String
_allowableInUrlQuery
protected static char
_JavaEscape
protected static char
_URIEscape
protected static String
alpha
protected static String
alphaNumeric
protected static String
numeric
-
Constructor Summary
Constructors Constructor Description EscapeStrings()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
backslashEscape(String x, String reservedChars)
backslash escape a stringstatic String
backslashEscapeCDMString(String s, String toescape)
Given a CDM string, insert backslashes beforecharacters. static String
backslashEscapeDapString(String s)
Given a DAP (attribute) string, insert backslashes before '"' and '/' characters.static String
backslashToDAP(String bs)
Given a backslash escaped name, convert to a DAP escaped namestatic String
backslashUnescape(String x)
backslash unescape a stringstatic String
escapeDAPIdentifier(String s)
Define the DAP escape identifier function.static String
escapeOGC(String s)
Define the OGC Web Services escape function.static String
escapeURL(String url)
Deprecated.do not usestatic String
escapeURLQuery(String ce)
Define the DEFINITIVE URL constraint expression escape function.static int
indexOf(String escapedName, char c)
Find first occurence of char c in escapedName, excluding escaped c.static String
normalizeToXML(String s)
Deprecated.do not usestatic void
testOGC()
static List<String>
tokenizeEscapedName(String escapedName)
Tokenize an escaped name using "." as delimiter, skipping "\."static String
unescapeDAPIdentifier(String id)
Define the DEFINITIVE opendap identifier unescape function.static String
unescapeURL(String url)
Decode all of the parts of the url including query and fragmentstatic String
unescapeURLQuery(String ce)
Define the DEFINITIVE URL constraint expression unescape function.static String
urlDecode(String s)
Define the DEFINITIVE URL unescape function.
-
-
-
Field Detail
-
alpha
protected static final String alpha
- See Also:
- Constant Field Values
-
numeric
protected static final String numeric
- See Also:
- Constant Field Values
-
alphaNumeric
protected static final String alphaNumeric
- See Also:
- Constant Field Values
-
_allowableInUrl
protected static final String _allowableInUrl
- See Also:
- Constant Field Values
-
_allowableInUrlQuery
protected static final String _allowableInUrlQuery
- See Also:
- Constant Field Values
-
_allowableInDAP
protected static final String _allowableInDAP
- See Also:
- Constant Field Values
-
_allowableInOGC
protected static final String _allowableInOGC
- See Also:
- Constant Field Values
-
_URIEscape
protected static final char _URIEscape
- See Also:
- Constant Field Values
-
_JavaEscape
protected static final char _JavaEscape
- See Also:
- Constant Field Values
-
-
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.
-
escapeURL
@Deprecated public static String escapeURL(String url)
Deprecated.do not use
-
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 nullreservedChars
- 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 stringc
- for this char but not \\cha- Returns:
- pos in string, or -1
-
normalizeToXML
@Deprecated public static String normalizeToXML(String s)
Deprecated.do not use
-
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.
-
-