|
|
@ -174,13 +174,20 @@ public class ClassAnalyzer implements Analyzer { |
|
|
|
private static String quoted(String str) { |
|
|
|
private static String quoted(String str) { |
|
|
|
StringBuffer result = new StringBuffer("\""); |
|
|
|
StringBuffer result = new StringBuffer("\""); |
|
|
|
for (int i=0; i< str.length(); i++) { |
|
|
|
for (int i=0; i< str.length(); i++) { |
|
|
|
switch (str.charAt(i)) { |
|
|
|
char c; |
|
|
|
|
|
|
|
switch (c = str.charAt(i)) { |
|
|
|
|
|
|
|
case '\0': |
|
|
|
|
|
|
|
result.append("\\0"); |
|
|
|
|
|
|
|
break; |
|
|
|
case '\t': |
|
|
|
case '\t': |
|
|
|
result.append("\\t"); |
|
|
|
result.append("\\t"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case '\n': |
|
|
|
case '\n': |
|
|
|
result.append("\\n"); |
|
|
|
result.append("\\n"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case '\r': |
|
|
|
|
|
|
|
result.append("\\r"); |
|
|
|
|
|
|
|
break; |
|
|
|
case '\\': |
|
|
|
case '\\': |
|
|
|
result.append("\\\\"); |
|
|
|
result.append("\\\\"); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -188,7 +195,17 @@ public class ClassAnalyzer implements Analyzer { |
|
|
|
result.append("\\\""); |
|
|
|
result.append("\\\""); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
|
|
|
|
if (c < 32) { |
|
|
|
|
|
|
|
String oct = Integer.toOctalString(c); |
|
|
|
|
|
|
|
result.append("\\000".substring(0, 4-oct.length())) |
|
|
|
|
|
|
|
.append(oct); |
|
|
|
|
|
|
|
} else if (c >= 32 && c < 127) |
|
|
|
result.append(str.charAt(i)); |
|
|
|
result.append(str.charAt(i)); |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
String hex = Integer.toHexString(c); |
|
|
|
|
|
|
|
result.append("\\u0000".substring(0, 6-hex.length())) |
|
|
|
|
|
|
|
.append(hex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result.append("\"").toString(); |
|
|
|
return result.append("\"").toString(); |
|
|
|