commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r788245 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java
Date Thu, 25 Jun 2009 03:55:19 GMT
Author: bayard
Date: Thu Jun 25 03:55:18 2009
New Revision: 788245

URL: http://svn.apache.org/viewvc?rev=788245&view=rev
Log:
Updating ESCAPE_JAVA to use the new .with() approach and to fold the two unicode escape methods
into one. 

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java?rev=788245&r1=788244&r2=788245&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java
Thu Jun 25 03:55:18 2009
@@ -30,15 +30,21 @@
 public class EscapeUtils {
 
     public static final CharSequenceTranslator ESCAPE_JAVA = 
-        new AggregateTranslator(
-            new LookupTranslator(
-                      new String[][] { 
-                            {"\"", "\\\""},
-                            {"\\", "\\\\"}
-                      }),
-            new EscapeLowAsciiAsUnicode(),
-            new EscapeNonAsciiAsUnicode()
-        );
+          new LookupTranslator(
+            new String[][] { 
+              {"\"", "\\\""},
+              {"\\", "\\\\"},
+          }).with(
+          new LookupTranslator(
+            new String[][] {
+              {"\b", "\\b"},
+              {"\n", "\\n"},
+              {"\t", "\\t"},
+              {"\f", "\\f"},
+              {"\r", "\\r"}
+          }).with(
+          UnicodeEscaper.outsideOf(32, 0x7f) 
+        ));
 
     public static final String escapeJava(String input) {
         return ESCAPE_JAVA.translate(input);



Mime
View raw message