From 749a82103120f0749a3801bfc454bcf954f54ec7 Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Mon, 23 Jul 2007 16:46:06 +0000 Subject: *** empty log message *** --- .../src/org/eclipse/net4j/util/io/IOUtil.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java index 0e735e209a..f8752e24af 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java @@ -153,4 +153,30 @@ public final class IOUtil throw new IORuntimeException(ex); } } + + public static boolean equals(InputStream stream1, InputStream stream2) throws IORuntimeException + { + try + { + for (;;) + { + int byte1 = stream1.read(); + int byte2 = stream2.read(); + + if (byte1 != byte2) + { + return false; + } + + if (byte1 == -1)// Implies byte2 == -1 + { + return true; + } + } + } + catch (IOException ex) + { + throw new IORuntimeException(ex); + } + } } -- cgit v1.2.3