initial quantum version
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / util / io / InputStreamHelper.java
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/io/InputStreamHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/io/InputStreamHelper.java
new file mode 100644 (file)
index 0000000..33d4416
--- /dev/null
@@ -0,0 +1,18 @@
+package com.quantum.util.io;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author BC
+ */
+public class InputStreamHelper {
+    public static String readIntoString(InputStream inputStream) throws IOException {
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        for (int b = inputStream.read(); b >= 0; b = inputStream.read()) {
+            outputStream.write((byte) b);
+        }
+        return new String(outputStream.toByteArray());
+    }
+}