]> WPIA git - gigi.git/blobdiff - util-testing/org/cacert/gigi/util/IOUtils.java
upd: rename package name and all references to it
[gigi.git] / util-testing / org / cacert / gigi / util / IOUtils.java
diff --git a/util-testing/org/cacert/gigi/util/IOUtils.java b/util-testing/org/cacert/gigi/util/IOUtils.java
deleted file mode 100644 (file)
index c5dbd8d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.cacert.gigi.util;
-
-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;
-import java.net.URLConnection;
-
-public class IOUtils {
-
-    private IOUtils() {
-
-    }
-
-    public static String readURL(URLConnection in) {
-        try {
-            if ( !in.getContentType().equals("text/html; charset=UTF-8")) {
-                if (in instanceof HttpURLConnection && ((HttpURLConnection) in).getResponseCode() != 200) {
-                    System.err.println(readURL(new InputStreamReader(((HttpURLConnection) in).getErrorStream(), "UTF-8")));
-                }
-                throw new Error("Unrecognized content-type: " + in.getContentType());
-            }
-            return readURL(new InputStreamReader(in.getInputStream(), "UTF-8"));
-        } catch (IOException e) {
-            throw new Error(e);
-        }
-
-    }
-
-    public static String readURL(Reader in) {
-        CharArrayWriter caw = new CharArrayWriter();
-        char[] buffer = new char[1024];
-        int len = 0;
-        try {
-            while ((len = in.read(buffer)) > 0) {
-                caw.write(buffer, 0, len);
-            }
-            in.close();
-            return new String(caw.toCharArray());
-        } catch (IOException e) {
-            throw new Error(e);
-        }
-
-    }
-
-    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);
-            }
-            in.close();
-            return baos.toByteArray();
-        } catch (IOException e) {
-            throw new Error(e);
-        }
-    }
-}