def MessageToString(message, as_utf8=False, as_one_line=False): out = SimIO() PrintMessage(message, out, as_utf8=as_utf8, as_one_line=as_one_line) result = out.getvalue() out.close() if as_one_line: return result.rstrip() return result
def SerializePartialToString(self): out = SimIO() self._InternalSerialize(out.write) return out.getvalue()