|
|
|
@ -38,58 +38,6 @@ public final class TextFormat { |
|
|
|
|
|
|
|
|
|
private static final String DEBUG_STRING_SILENT_MARKER = "\t "; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Outputs a textual representation of the Protocol Message supplied into the parameter output. |
|
|
|
|
* (This representation is the new version of the classic "ProtocolPrinter" output from the |
|
|
|
|
* original Protocol Buffer system) |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().print(MessageOrBuilder, Appendable)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
@InlineMe( |
|
|
|
|
replacement = "TextFormat.printer().print(message, output)", |
|
|
|
|
imports = "com.google.protobuf.TextFormat") |
|
|
|
|
public static void print(final MessageOrBuilder message, final Appendable output) |
|
|
|
|
throws IOException { |
|
|
|
|
printer().print(message, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Outputs a textual representation of {@code fields} to {@code output}. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().print(UnknownFieldSet, Appendable)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static void print(final UnknownFieldSet fields, final Appendable output) |
|
|
|
|
throws IOException { |
|
|
|
|
printer().print(fields, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Same as {@code print()}, except that non-ASCII characters are not escaped. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().escapingNonAscii(false).print(MessageOrBuilder, Appendable)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
@InlineMe( |
|
|
|
|
replacement = "TextFormat.printer().escapingNonAscii(false).print(message, output)", |
|
|
|
|
imports = "com.google.protobuf.TextFormat") |
|
|
|
|
public static void printUnicode(final MessageOrBuilder message, final Appendable output) |
|
|
|
|
throws IOException { |
|
|
|
|
printer().escapingNonAscii(false).print(message, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Same as {@code print()}, except that non-ASCII characters are not escaped. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().escapingNonAscii(false).print(UnknownFieldSet, Appendable)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static void printUnicode(final UnknownFieldSet fields, final Appendable output) |
|
|
|
|
throws IOException { |
|
|
|
|
printer().escapingNonAscii(false).print(fields, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generates a human readable form of this message, useful for debugging and other purposes, with |
|
|
|
|
* no newline characters. This is just a trivial wrapper around {@link |
|
|
|
@ -99,130 +47,6 @@ public final class TextFormat { |
|
|
|
|
return printer().shortDebugString(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generates a human readable form of the field, useful for debugging and other purposes, with |
|
|
|
|
* no newline characters. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().shortDebugString(FieldDescriptor, Object)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static String shortDebugString(final FieldDescriptor field, final Object value) { |
|
|
|
|
return printer().shortDebugString(field, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generates a human readable form of the unknown fields, useful for debugging and other |
|
|
|
|
* purposes, with no newline characters. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().shortDebugString(UnknownFieldSet)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static String shortDebugString(final UnknownFieldSet fields) { |
|
|
|
|
return printer().shortDebugString(fields); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Like {@code print()}, but writes directly to a {@code String} and returns it. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code message.toString()} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
@InlineMe( |
|
|
|
|
replacement = "TextFormat.printer().printToString(message)", |
|
|
|
|
imports = "com.google.protobuf.TextFormat") |
|
|
|
|
public static String printToString(final MessageOrBuilder message) { |
|
|
|
|
return printer().printToString(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Like {@code print()}, but writes directly to a {@code String} and returns it. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@link UnknownFieldSet#toString()} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static String printToString(final UnknownFieldSet fields) { |
|
|
|
|
return printer().printToString(fields); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Same as {@code printToString()}, except that non-ASCII characters in string type fields are not |
|
|
|
|
* escaped in backslash+octals. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().escapingNonAscii(false).printToString(MessageOrBuilder)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
@InlineMe( |
|
|
|
|
replacement = "TextFormat.printer().escapingNonAscii(false).printToString(message)", |
|
|
|
|
imports = "com.google.protobuf.TextFormat") |
|
|
|
|
public static String printToUnicodeString(final MessageOrBuilder message) { |
|
|
|
|
return printer().escapingNonAscii(false).printToString(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Same as {@code printToString()}, except that non-ASCII characters in string type fields are |
|
|
|
|
* not escaped in backslash+octals. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().escapingNonAscii(false).printToString(UnknownFieldSet)} |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static String printToUnicodeString(final UnknownFieldSet fields) { |
|
|
|
|
return printer().escapingNonAscii(false).printToString(fields); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @deprecated Use {@code printer().printField(FieldDescriptor, Object, Appendable)} */ |
|
|
|
|
@Deprecated |
|
|
|
|
public static void printField( |
|
|
|
|
final FieldDescriptor field, final Object value, final Appendable output) |
|
|
|
|
throws IOException { |
|
|
|
|
printer().printField(field, value, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @deprecated Use {@code printer().printFieldToString(FieldDescriptor, Object)} */ |
|
|
|
|
@Deprecated |
|
|
|
|
public static String printFieldToString(final FieldDescriptor field, final Object value) { |
|
|
|
|
return printer().printFieldToString(field, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Outputs a unicode textual representation of the value of given field value. |
|
|
|
|
* |
|
|
|
|
* <p>Same as {@code printFieldValue()}, except that non-ASCII characters in string type fields |
|
|
|
|
* are not escaped in backslash+octals. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().escapingNonAscii(false).printFieldValue(FieldDescriptor, |
|
|
|
|
* Object, Appendable)} |
|
|
|
|
* @param field the descriptor of the field |
|
|
|
|
* @param value the value of the field |
|
|
|
|
* @param output the output to which to append the formatted value |
|
|
|
|
* @throws ClassCastException if the value is not appropriate for the given field descriptor |
|
|
|
|
* @throws IOException if there is an exception writing to the output |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public static void printUnicodeFieldValue( |
|
|
|
|
final FieldDescriptor field, final Object value, final Appendable output) |
|
|
|
|
throws IOException { |
|
|
|
|
printer().escapingNonAscii(false).printFieldValue(field, value, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Outputs a textual representation of the value of given field value. |
|
|
|
|
* |
|
|
|
|
* @deprecated Use {@code printer().printFieldValue(FieldDescriptor, Object, Appendable)} |
|
|
|
|
* @param field the descriptor of the field |
|
|
|
|
* @param value the value of the field |
|
|
|
|
* @param output the output to which to append the formatted value |
|
|
|
|
* @throws ClassCastException if the value is not appropriate for the given field descriptor |
|
|
|
|
* @throws IOException if there is an exception writing to the output |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
@InlineMe( |
|
|
|
|
replacement = "TextFormat.printer().printFieldValue(field, value, output)", |
|
|
|
|
imports = "com.google.protobuf.TextFormat") |
|
|
|
|
public static void printFieldValue( |
|
|
|
|
final FieldDescriptor field, final Object value, final Appendable output) throws IOException { |
|
|
|
|
printer().printFieldValue(field, value, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Outputs a textual representation of the value of an unknown field. |
|
|
|
|
* |
|
|
|
|