Code Completion inserts the brackets after functions now
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / util / StreamUtil.java
1 /*
2  * Created on 06.09.2003
3  *
4  */
5 package net.sourceforge.phpdt.internal.ui.util;
6
7 import java.io.IOException;
8 import java.io.InputStream;
9 import java.io.OutputStream;
10
11 /**
12  * @author khartlage
13  * */
14 public class StreamUtil {
15   public static void transferStreams(InputStream source, OutputStream destination) throws IOException {
16     try {
17       byte[] buffer = new byte[8192];
18       while (true) {
19         int bytesRead = source.read(buffer);
20         if (bytesRead == -1)
21           break;
22         destination.write(buffer, 0, bytesRead);
23       }
24     } finally {
25       try {
26         source.close();
27       } catch (IOException e) {
28       }
29       try {
30         destination.close();
31       } catch (IOException e) {
32       }
33     }
34   }
35 }