]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/testUtils/IOUtils.java
UPD: Set default time Zone for (configed) test cases to UTC.
[gigi.git] / tests / org / cacert / gigi / testUtils / IOUtils.java
index e33192e7d1fb893e228b40fad3372cc1c14ac45b..9a01a542d056ee1577cfc9eefd59c4b75b351ad8 100644 (file)
@@ -1,7 +1,9 @@
 package org.cacert.gigi.testUtils;
 
+import java.io.ByteArrayOutputStream;
 import java.io.CharArrayWriter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.HttpURLConnection;
@@ -42,4 +44,18 @@ public class IOUtils {
         }
 
     }
+
+    public static byte[] readURL(InputStream in) {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        try {
+            while ((len = in.read(buffer)) > 0) {
+                baos.write(buffer, 0, len);
+            }
+            return baos.toByteArray();
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+    }
 }