public static <M extends Message>String writeJsonStream(ImmutableList<M> messages){
  ByteArrayOutputStream resultStream=new ByteArrayOutputStream();
  MessageWriter<M> writer=MessageWriter.create(Output.forStream(new PrintStream(resultStream)));
  writer.writeAll(messages);
  return resultStream.toString();
}

public static < M extends Message > String writeJsonStream ( ImmutableList < M > messages ) { ByteArrayOutputStream resultStream = new ByteArrayOutputStream ( ) ; MessageWriter < M > writer = MessageWriter . create ( Output . forStream ( new PrintStream ( resultStream ) ) ) ; writer . writeAll ( messages ) ; return resultStream . toString ( ) ; }
returns the string representation of the stream of supplied messages . each individual message is represented as valid json , but not that the whole result is , itself , * not * valid json .
