]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.fastlz/testcases/org/simantics/fastlz/ChecksumUtil.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.fastlz / testcases / org / simantics / fastlz / ChecksumUtil.java
index 04cdde232bf4192729fec4230408a4d12e84c752..aea3a02963478c4e7f35b36fb82dda70a5c6b377 100644 (file)
@@ -1,71 +1,71 @@
-package org.simantics.fastlz;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.net.URL;\r
-import java.security.MessageDigest;\r
-import java.security.NoSuchAlgorithmException;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public final class ChecksumUtil {\r
-\r
-    public static byte[] computeSum(byte[] in) {\r
-        if (in == null)\r
-            throw new IllegalArgumentException("Input cannot be null!");\r
-        try {\r
-            MessageDigest md = MessageDigest.getInstance("MD5");\r
-            md.update(in, 0, in.length);\r
-            return md.digest();\r
-        } catch (NoSuchAlgorithmException e) {\r
-            throw new Error("MD5 digest must be supported by JVM");\r
-        }\r
-    }\r
-\r
-    public static byte[] computeSum(InputStream in) throws IOException {\r
-        if (in == null)\r
-            throw new IllegalArgumentException("Input cannot be null!");\r
-\r
-        MessageDigest md;\r
-        try {\r
-            md = MessageDigest.getInstance("MD5");\r
-        } catch (NoSuchAlgorithmException e) {\r
-            throw new Error("MD5 digest must be supported by JVM");\r
-        }\r
-        byte[] data = new byte[64 * 1024];\r
-\r
-        while (true) {\r
-            int read = in.read(data);\r
-            if (read == -1) {\r
-                return md.digest();\r
-            }\r
-            md.update(data, 0, read);\r
-        }\r
-    }\r
-\r
-    public static byte[] computeSum(File f) throws IOException {\r
-        InputStream in = null;\r
-        try {\r
-            in = new FileInputStream(f);\r
-            return computeSum(in);\r
-        } finally {\r
-            if (in != null)\r
-                in.close();\r
-        }\r
-    }\r
-\r
-    public static byte[] computeSum(URL url) throws IOException {\r
-        InputStream in = null;\r
-        try {\r
-            in = url.openStream();\r
-            return computeSum(in);\r
-        } finally {\r
-            if (in != null)\r
-                in.close();\r
-        }\r
-    }\r
-\r
-}\r
+package org.simantics.fastlz;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public final class ChecksumUtil {
+
+    public static byte[] computeSum(byte[] in) {
+        if (in == null)
+            throw new IllegalArgumentException("Input cannot be null!");
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update(in, 0, in.length);
+            return md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new Error("MD5 digest must be supported by JVM");
+        }
+    }
+
+    public static byte[] computeSum(InputStream in) throws IOException {
+        if (in == null)
+            throw new IllegalArgumentException("Input cannot be null!");
+
+        MessageDigest md;
+        try {
+            md = MessageDigest.getInstance("MD5");
+        } catch (NoSuchAlgorithmException e) {
+            throw new Error("MD5 digest must be supported by JVM");
+        }
+        byte[] data = new byte[64 * 1024];
+
+        while (true) {
+            int read = in.read(data);
+            if (read == -1) {
+                return md.digest();
+            }
+            md.update(data, 0, read);
+        }
+    }
+
+    public static byte[] computeSum(File f) throws IOException {
+        InputStream in = null;
+        try {
+            in = new FileInputStream(f);
+            return computeSum(in);
+        } finally {
+            if (in != null)
+                in.close();
+        }
+    }
+
+    public static byte[] computeSum(URL url) throws IOException {
+        InputStream in = null;
+        try {
+            in = url.openStream();
+            return computeSum(in);
+        } finally {
+            if (in != null)
+                in.close();
+        }
+    }
+
+}