Merge remote-tracking branch 'origin/master' into jetty-9.1
This commit is contained in:
commit
48ae7ec3f6
|
@ -334,12 +334,15 @@ public class QuotedStringTokenizer
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Quote a string into an Appendable.
|
||||
* Only quotes and backslash are escaped.
|
||||
* Only quotes and backslash are escaped.
|
||||
* @param buffer The Appendable
|
||||
* @param input The String to quote.
|
||||
*/
|
||||
public static void quoteOnly(Appendable buffer, String input)
|
||||
{
|
||||
if(input==null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
buffer.append('"');
|
||||
|
@ -366,6 +369,9 @@ public class QuotedStringTokenizer
|
|||
*/
|
||||
public static void quote(Appendable buffer, String input)
|
||||
{
|
||||
if(input==null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
buffer.append('"');
|
||||
|
@ -403,14 +409,14 @@ public class QuotedStringTokenizer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public static String unquoteOnly(String s)
|
||||
{
|
||||
return unquoteOnly(s, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Unquote a string, NOT converting unicode sequences
|
||||
* @param s The string to unquote.
|
||||
|
@ -454,15 +460,15 @@ public class QuotedStringTokenizer
|
|||
}
|
||||
}
|
||||
|
||||
return b.toString();
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public static String unquote(String s)
|
||||
{
|
||||
return unquote(s,false);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Unquote a string.
|
||||
* @param s The string to unquote.
|
||||
|
@ -544,8 +550,8 @@ public class QuotedStringTokenizer
|
|||
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Check that char c (which is preceded by a backslash) is a valid
|
||||
* escape sequence.
|
||||
|
@ -554,8 +560,8 @@ public class QuotedStringTokenizer
|
|||
*/
|
||||
private static boolean isValidEscaping(char c)
|
||||
{
|
||||
return ((c == 'n') || (c == 'r') || (c == 't') ||
|
||||
(c == 'f') || (c == 'b') || (c == '\\') ||
|
||||
return ((c == 'n') || (c == 'r') || (c == 't') ||
|
||||
(c == 'f') || (c == 'b') || (c == '\\') ||
|
||||
(c == '/') || (c == '"') || (c == 'u'));
|
||||
}
|
||||
|
||||
|
@ -564,7 +570,7 @@ public class QuotedStringTokenizer
|
|||
{
|
||||
return s!=null && s.length()>0 && s.charAt(0)=='"' && s.charAt(s.length()-1)=='"';
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return handle double quotes if true
|
||||
|
|
Loading…
Reference in New Issue