]> Dogcows Code - chaz/vimcoder/blobdiff - src/com/dogcows/Util.java
rename quote method to escape
[chaz/vimcoder] / src / com / dogcows / Util.java
index 47fdd20d1cdef9c51d0d23ad90c7e0702ba59ab1..412ef4a95b2e24258ec137777cb7bbfe3e058048 100644 (file)
@@ -61,12 +61,12 @@ public abstract class Util
        }
 
        /**
-        * 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("\"",   "\\\\\\\"");
@@ -98,7 +98,7 @@ public abstract class Util
                        reader.close();
                }
 
-               return text.toString();
+               return text.toString().replaceAll("\n", System.getProperty("line.separator"));
        }
 
        /**
@@ -120,7 +120,7 @@ public abstract class Util
                        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));
@@ -132,7 +132,7 @@ public abstract class Util
                        }
                }
 
-               return text.toString();
+               return text.toString().replaceAll("\n", System.getProperty("line.separator"));
        }
 
        /**
@@ -151,8 +151,7 @@ public abstract class Util
                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;
        }
This page took 0.022129 seconds and 4 git commands to generate.