]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/testUtils/IOUtils.java
Format code according do BenBE's formatter.
[gigi.git] / tests / org / cacert / gigi / testUtils / IOUtils.java
index 2db46f87832bb8acfeb2d90fb571b6cb22ec6cab..e33192e7d1fb893e228b40fad3372cc1c14ac45b 100644 (file)
@@ -8,38 +8,38 @@ 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);
-                       }
-                       return new String(caw.toCharArray());
-               } catch (IOException e) {
-                       throw new Error(e);
-               }
-
-       }
+
+    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);
+            }
+            return new String(caw.toCharArray());
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+
+    }
 }