}
/**
- * Quote a string by replacing prepending backslashes and double
+ * Escape a string by replacing prepending backslashes and double
* quotation characters with an extra backslash.
- * @param The string to be quoted.
- * @return The quoted string.
+ * @param The string to be escaped.
+ * @return The escaped string.
*/
- public static String quote(String a)
+ public static String escape(String a)
{
a = a.replaceAll("\\\\", "\\\\\\\\");
a = a.replaceAll("\"", "\\\\\\\"");
try
{
byte[] buffer = new byte[4096];
- int numBytes = 0;
+ int numBytes = 0;
while (0 < (numBytes = stream.read(buffer)))
{
text.append(new String(buffer, 0, numBytes));
String text = template;
for (String key : terms.keySet())
{
- text = text.replaceAll("\\$" + key + "\\$",
- Util.quote(terms.get(key)));
+ text = text.replaceAll("\\$" + key + "\\$", Util.escape(terms.get(key)));
}
return text;
}
}
+// vim:noet:ts=8