Explorar o código

add printUnicode methods in TextFormat

jieluo@google.com %!s(int64=11) %!d(string=hai) anos
pai
achega
01283faa47
Modificáronse 1 ficheiros con 20 adicións e 0 borrados
  1. 20 0
      java/src/main/java/com/google/protobuf/TextFormat.java

+ 20 - 0
java/src/main/java/com/google/protobuf/TextFormat.java

@@ -83,6 +83,26 @@ public final class TextFormat {
     DEFAULT_PRINTER.printUnknownFields(fields, new TextGenerator(output));
     DEFAULT_PRINTER.printUnknownFields(fields, new TextGenerator(output));
   }
   }
 
 
+  /**
+   * Same as {@code print()}, except that non-ASCII characters are not
+   * escaped.
+   */
+  public static void printUnicode(
+      final MessageOrBuilder message, final Appendable output)
+      throws IOException {
+    UNICODE_PRINTER.print(message, new TextGenerator(output));
+  }
+
+  /**
+   * Same as {@code print()}, except that non-ASCII characters are not
+   * escaped.
+   */
+  public static void printUnicode(final UnknownFieldSet fields,
+                                  final Appendable output)
+                                  throws IOException {
+    UNICODE_PRINTER.printUnknownFields(fields, new TextGenerator(output));
+  }
+
   /**
   /**
    * Generates a human readable form of this message, useful for debugging and
    * Generates a human readable form of this message, useful for debugging and
    * other purposes, with no newline characters.
    * other purposes, with no newline characters.