예제 #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);
   }
 }
예제 #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);
   }
 }