package org.ligi.axt.extensions;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class InputStreamAXT {

    private final InputStream inputStream;

    public InputStreamAXT(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    public void toFile(File f) throws IOException {
        FileOutputStream fos = new FileOutputStream(f);

        byte[] buffer = new byte[1024];
        int len;

        while ((len = inputStream.read(buffer)) > 0) {
            fos.write(buffer, 0, len);
        }

    }

    public String readToString() throws IOException {
        InputStreamReader is = new InputStreamReader(inputStream);
        StringBuilder sb = new StringBuilder();
        BufferedReader br = new BufferedReader(is);
        String read = br.readLine();

        while (read != null) {
            sb.append(read);
            read = br.readLine();
        }

        return sb.toString();
    }
}

@@ -234,16 +234,81 @@
 mAXT %7B%0A%0A
+    private static final int CHARACTER_READ_BUFFER_SIZE = 1024;%0A%0A
     priv
@@ -855,47 +855,228 @@
     
-StringBuilder sb = new StringBuilder();
+try %7B%0A            return readFromInputStreamReaderToString(is);%0A        %7D finally %7B%0A            is.close();%0A        %7D%0A    %7D%0A%0A    private String readFromInputStreamReaderToString(InputStreamReader is) throws IOException %7B
 %0A   
@@ -1095,17 +1095,21 @@
 dReader 
-b
+reade
 r = new 
@@ -1129,76 +1129,244 @@
 r(is
-);%0A        String read = br.readLine();%0A%0A        while (read != null
+, CHARACTER_READ_BUFFER_SIZE);%0A        try %7B%0A            char%5B%5D buffer = new char%5BCHARACTER_READ_BUFFER_SIZE%5D;%0A            StringBuilder sb = new StringBuilder();%0A%0A            int len;%0A            while ((len = reader.read(buffer)) %3E= 0
 ) %7B%0A
@@ -1377,16 +1377,20 @@
         
+    
 sb.appen
@@ -1391,20 +1391,30 @@
 .append(
-read
+buffer, 0, len
 );%0A     
@@ -1424,26 +1424,41 @@
     
-read = br.readLine
+%7D%0A%0A            return sb.toString
 ();%0A
@@ -1470,39 +1470,56 @@
    %7D
-%0A%0A        return sb.toString();
+ finally %7B%0A            reader.close();%0A        %7D
 %0A   

Fix InputStreamAXT.readToString() to be able to handle multiline strings