Extended the builder with an index file generator for PHP class- and function-names.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / util / StreamUtil.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/StreamUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/StreamUtil.java
new file mode 100644 (file)
index 0000000..cdfe20d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Created on 06.09.2003
+ *
+ */
+package net.sourceforge.phpdt.internal.ui.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author khartlage
+ * */
+public class StreamUtil {
+  public static void transferStreams(InputStream source, OutputStream destination) throws IOException {
+    try {
+      byte[] buffer = new byte[8192];
+      while (true) {
+        int bytesRead = source.read(buffer);
+        if (bytesRead == -1)
+          break;
+        destination.write(buffer, 0, bytesRead);
+      }
+    } finally {
+      try {
+        source.close();
+      } catch (IOException e) {
+      }
+      try {
+        destination.close();
+      } catch (IOException e) {
+      }
+    }
+  }
+}