package com.github.noxan.aves.protocol.string;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public class StringOutputProtocol {
    private BufferedWriter out;

    public StringOutputProtocol(OutputStream out) {
	this.out = new BufferedWriter(new OutputStreamWriter(out));
    }

    public void write(Object data) throws IOException {
	out.write(data.toString());
	out.flush();
    }
}

@@ -415,18 +415,21 @@
  %7B%0A%09
-out.write(
+String str = 
 data
@@ -439,16 +439,81 @@
 String()
+;%0A%09if (!str.endsWith(%22%5Cn%22)) %7B%0A%09    str += %22%5Cn%22;%0A%09%7D%0A%09out.write(str
 );%0A%09out.

add line separator to message in write method in stringoutputstream if it does not end with one