Exemplo n.º 1
0
 /**
  * Like {@code print()}, but writes directly to a {@code String} and
  * returns it.
  */
 public static String printToString(final UnknownFieldSet fields) {
   try {
     final StringBuilder text = new StringBuilder();
     print(fields, text);
     return text.toString();
   } catch (IOException e) {
     throw new IllegalStateException(e);
   }
 }
Exemplo n.º 2
0
 /**
  * Like {@code print()}, but writes directly to a {@code String} and
  * returns it.
  */
 public static String printToString(final MessageOrBuilder message) {
   try {
     final StringBuilder text = new StringBuilder();
     print(message, text);
     return text.toString();
   } catch (IOException e) {
     throw new IllegalStateException(e);
   }
 }