/** * 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); } }
/** * 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); } }