+ private static String readAll(InputStream in) throws IOException {
+ StringWriter output = new StringWriter();
+ byte[] buffer = new byte[4096];
+ long count = 0;
+ int n;
+ while (-1 != (n = System.in.read(buffer))) {
+ output.write(new String(buffer, 0, n, Charset.defaultCharset()));
+ count += n;
+ }
+ return output.toString();
+ }
+